Mail Archives: djgpp/1999/10/04/15:43:07
Eli Zaretskii writes:
>>> What you need to do is to divide a single module into several smaller
>>> modules. Then the linker will only link in those modules which you
>>> actually need in your program.
>>
>> Of course - but in fact (after some inquiry etc.) the `ld' linker is
almost
>> the only that can't do it itself!
>
> If you think GNU ld should support this feature, I suggest posting to
> gnu.utils.bug
I'm fairly sure that this cannot be done using only the information output
by gcc. To leave out unused functions, you'd need to know the origin and
size for every symbol, and also be sure that there were no relative offsets
from one symbol to another, wheras standard object formats only give you
a block of code with the origin of each symbol, but no size information.
It might be possible to deduce the other data for gcc output (I don't know
enough about the compiler to judge that), but certainly isn't possible
for manually written asm sources, so this wouldn't be a safe optimisation
to apply.
I don't think it is at all unusual that GNU ld works this way: most other
compilers that I have used do exactly the same thing.
Shawn Hargreaves.
- Raw text -