-ffunction-sections -fdata-sections have no effect

Kristof Provost Kristof.Provost@telenet.be
Wed Oct 18 08:53:00 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Valentin Longchamp schreef:
> Hello,
> 
> I am working with an arm-none-linux-gnueabi toolchain I built using 
> crosstool-0.42 with Martin Guy's pathes. Here is my config script so that you 
> have all the information:
> 
>> #!/bin/sh
>> set -ex
>> TARBALLS_DIR=$HOME/EPFL/diplome_ASL/toolchain/work
>> RESULT_TOP=/opt/crosstool
>> export TARBALLS_DIR RESULT_TOP
>>
>> SRC_DIR=$HOME/EPFL/diplome_ASL/toolchain/work
>> export SRC_DIR
>>
>> # Really, you should do the mkdir before running this,
>> # and chown /opt/crosstool to yourself so you don't need to run as root.
>> mkdir -p $RESULT_TOP
>>
>> BINUTILS_DIR=binutils-2.16.92
>> export BINUTILS_DIR
>>
>> BUILD=i686-pc-linux-gnu
>> export BUILD
>> BUILD_DIR=$HOME/EPFL/diplome_ASL/toolchain/crosstool-0.42/build/arm-none-li
>> nux-gnueabi/gcc-4.1.1-glibc-2.4-nptl-2 export BUILD_DIR
>>
>> EXTRA_TARGET_CFLAGS=-mabi=aapcs-linux
>> export EXTRA_TARGET_CFLAGS
>>
>> GCC_CORE_DIR=gcc-4.1.1
>> export GCC_CORE_DIR
>> GCC_DIR=gcc-4.1.1
>> export GCC_DIR
>> GCC_EXTRA_CONFIG=--disable-libunwind-exceptions
>> export GCC_EXTRAG_CONFIG
>> GCC_LANGUAGES=c,c++
>> export GCC_LANGUAGES
>>
>>
>> GLIBCPORTS_FILENAME=glibc-ports-2.4
>> export GLIBCPORTS_FILENAME
>> GLIBC_ADDON_OPTIONS=nptl,../glibc-2.4/ports
>> export GLIBC_ADDON_OPTIONS
>> GLIBC_DIR=glibc-2.4
>> export GLIBC_DIR
>> GLIBC_EXTRA_CONFIG="--with-tls --with-__thread --enable-kernel=2.6.4
>> --with-abi=aapcs-linux"
>>
>> export GLIBC_EXTRA_CONFIG
>> KERNELCONFIG=$HOME/EPFL/diplome_ASL/toolchain/crosstool-0.42/armeabi.config
>> export KERNELCONFIG
>> LINUX_DIR=linux-2.6.17.1
>> export LINUX_DIR
>>
>> PREFIX=/opt/crosstool/gcc-4.1.1-glibc-2.4-nptl-2/arm-none-linux-gnueabi
>> export PREFIX
>> SHARED_MODE=--enable-shared
>> export SHARED_MODE
>>
>> TARGET=arm-none-linux-gnueabi
>> export TARGET
>> TARGET_CFLAGS=-O
>> export TARGET_CFLAGS
>>
>> TOP_DIR=$HOME/EPFL/diplome_ASL/toolchain/crosstool-0.42
>> export TOP_DIR
>>
>> sh all.sh --notest
> 
> When I add the -ffunction-sections -fdata-sections to my static builds in 
> order to have small and easily distributable binaries for the platform, I 
> still get the same huge binary, like if the whole glibc was included.
> 
> Do I need to put some extra toolchain build config information to get the 
> wanted result ?
> 
> Thank you
> 
> Valentin

A couple of ideas:
Did you remember to use -gc-sections when linking?
Did you strip the binary?

What's your output data format? Are you creating ELF files? Not all
output formats support arbitraty sections.

Kristof
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFNeuTUEZ9DhGwDugRA1pQAJ45JaNn9O+iPQmhbB36DnyMTkoivgCfWQ+8
2Tgakv5Xp7tq5gbNdZszlgg=
=EzBQ
-----END PGP SIGNATURE-----

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list