Question about archive search behavior vs. --defsym
H.J. Lu
hjl.tools@gmail.com
Thu Sep 9 14:48:00 GMT 2010
On Wed, Sep 8, 2010 at 11:55 PM, Mark Mitchell <mark@codesourcery.com> wrote:
> On 9/8/2010 11:19 PM, Ian Lance Taylor wrote:
>
>>> $ gcc main.c -Wl,--defsym=f=4 -L. -lf
>>>
>>> pulls in f.o from libf.a even though the symbol is already defined.
>
>> It's a phase ordering problem. Objects are pulled in from archives
>> before symbol assignments are processed.
>
>> I think this has to be considered a bug.
>
> OK. Is this a structurally hard thing to fix? Or just something that
> would take some effort? And, does GOLD handle this correctly?
>
Gold behaves the same. I am not sure if it is a bug. --defsym or
assignment in linker script overwrites any symbols, which may
be defined in object, archive or DSO.
--
H.J.
More information about the Binutils
mailing list