More agressive entity removal during linking
Jeffrey A Law
law@cygnus.com
Wed Dec 8 23:29:00 GMT 1999
In message < Pine.LNX.3.96.991208235251.5211S-100000@wakko.deltatee.com >you wr
ite:
>
> Hi,
>
> I have a m68k embedded target I have been working on, and I noticed that
> ld links the entire contents of a .o file (even if that .o is in a library
> archive) even if only a small number of symbols in that .o file are
> referenced.
That is standard behavior for most linkers, believe it or not.
> Given the restricted memory in my system I am interested in optimizing
> this, ideally ld would only include an entity if it was referenced by an
> already included entity.
This is typically known as garbage collecting linkers.
> I've read through the linker reference and it seems to me there are no
> flags to enable a size optimization like this - the only way seems to be
> to put 1 function/variable per .c file :<
There is an option to do this, but it requires target specific compiler,
assembler and linker support as well as a modern object format such as ELF
(coff is too lame, sorry).
jeff
More information about the Gcc
mailing list