This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to link in sub-object ganularity


Hi!

First of all apologies if this is not the right forum to ask this question.

So, my problem is that I would like to link my program to as small size as
possible. However I've noticed that the linker decides upon whole object
files to be placed in the executable instead of individual symbols. Moreover
the linker links in all object files it sees on the command line even if
it's not needed for the execution at all. A consequence of this is that I
have to resolve all dependences in those parts of the code that's never get
called, leading even more stuff begin put into the final binary.

I couldn't find any way to specify the linker to link-in only those symbols
I really need.

I guess the problem is that the linker cannot crack sections, so first I
would need to specify GCC to put each (extern) symbol into a different
section and than instruct the linker to do a per-section linking.

Or is there any other way to do this?

I've tried GCC 3.3.1/BU 2.14.90 for Mingw32, arm-elf and arm-pe targets, all
behaved the same way.

Please don't tell me it can't be done. I can't believe that I have to live
with huge portions of dead code in my binaries.

Thanks,
Andras Tantos


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]