This is the mail archive of the binutils@sourceware.org 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]

Re: Question about archive search behavior vs. --defsym


On Thu, Sep 9, 2010 at 9:17 AM, Ian Lance Taylor <iant@google.com> wrote:
> Mark Mitchell <mark@codesourcery.com> writes:
>
>> 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 has the same problem.
>
> I think it would be fairly easy to fix. ?Basically as soon as a --defsym
> or symbol assignment in a linker script is read, the linker would have
> to make a symbol table entry for the defined symbol. ?It would then have
> to fill in the values later.
>

A few details:

1. The symbol value may not be known at the time.
2. It should override symbol defined in an object file.


-- 
H.J.


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