-ffunction-sections -fdata-sections have no effect
Wed Oct 18 09:16:00 GMT 2006
On Wednesday 18 October 2006 10:53, Kristof Provost wrote:
> 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
> > 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 ?
> A couple of ideas:
> Did you remember to use -gc-sections when linking?
> Did you strip the binary?
Yes I did use the -gc-sections option when linking. What do you mean by "strip
the binary" ?
> What's your output data format? Are you creating ELF files? Not all
> output formats support arbitraty sections.
Yep, I'm creating ELF files. Is it a problem to do it with ELF files ? I
wouldn't think so.
By the way, I thought that if my toolchain isn't compiled with
both -ffunction-sections -fdata-section options, it isn't going to
be "separated" at the beginning and that's why I always get the same huge
binary when I compile my program static with or without the section options.
So I added the following option to my crosstool script:
> EXTRA_TARGET_CFLAGS="-mabi=aapcs-linux -ffunction-section -fdata-section"
> export EXTRA_TARGET_CFLAGS
However, using this, I get segfaulting binaries. Where should I add these
options so that my glibc is built with these options ? Maybe I should add it
to the GLIBC_EXTRA_CONFIG variable ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
More information about the crossgcc