bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selective linking using ld


From: Alan Modra
Subject: Re: Selective linking using ld
Date: Tue, 23 Apr 2002 19:29:01 +0930
User-agent: Mutt/1.3.25i

On Mon, Apr 22, 2002 at 11:24:37PM +0200, address@hidden wrote:
> Question #1:
>    Since a year has passed now, I would like to know, if this problem has 
> found
>    a solution yet ?

Use -u sym on the command line or KEEP in a linker script.
eg. KEEP(*(.init*));

> Question #2:
>    The object modules that our target system produces use DWARF format, where
>    all the code in a single object module is described. If say one object 
> module
>    defines 5 functions, where of #2 and #5 are actually used, will  the-
>    -gc-sections option include #1, #3 and #4 as well, just because they are
>    referenced from the DWARF sections?

That will happen if a symbol in the dwarf section is referenced from some
other kept section, or if the linker script KEEPs the dwarf section.
There is a KEEP on .eh_frame (which may not have been such a good idea)

> Question #3:
>    If the DWARF references do not trigger the inclusion what will be the value
>    of the references that end up pointing to not loaded functions?

They're supposed to be zero.

> Question #4:
>    Is the principle that everything transitively referenced from the 
> application
>    entry point is included?

Yes, and additionally everything referenced from sections containing
-u syms on the command line, or sections marked by KEEP.  The linker
also understands section groups, so that a reference to any section
in a group will keep the whole group.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



reply via email to

[Prev in Thread] Current Thread [Next in Thread]