This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
How to link in sub-object ganularity
- From: "Andras Tantos" <andras_tantos at yahoo dot com>
- To: <binutils at sources dot redhat dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Tue, 2 Dec 2003 08:51:54 -0800
- Subject: How to link in sub-object ganularity
- Reply-to: "Andras Tantos" <andras_tantos at yahoo dot com>
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