More agressive entity removal during linking

Jonathan Larmour jlarmour@cygnus.co.uk
Fri Dec 31 23:54:00 GMT 1999


In article < 12283.944733480@upchuck > you write:
>  In message < Pine.LNX.3.96.991209003754.5211T-100000@wakko.deltatee.com >you
> write:
>  >  I have no quams about
>  > switching the output target format for the compiler. Which format should I
>  > use and which linker/compiler/assembler option turns this on (presumably
>  > --gc-sections?) ?
>You would want to use ELF.  Yes --gc-sections is the right linker option.  You
>will also need to use -ffucntion-sections so that the compiler puts each
>function into its own section.

You can also use -fdata-sections and for compiling C++, -fvtable-gc.

Your linker scripts may also need updating if you're using your own
linker scripts. This is because each symbol gets put into its own
input section, so you have to change e.g. *(.data) to *(.data*) etc.

Jifl



More information about the Gcc mailing list