This is the mail archive of the 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: gold regression vs BFD ld: __ehdr_start

>> I think what has to happen is something analogous to what BFD ld does now:
>> Add the symbol early on in an undefined or indeterminate state, and then
>> define it (or don't) later on.  It's not very clear to me how to do that
>> correctly in gold.  It would seem clearest if it can be done in
>> define_standard_symbols.  But I don't know what Layout::finalize (where
>> it's created now) should do to find it and adjust it to point at the right
>> segment.  I also don't know how either case would interact with a user
>> defining (in input or script) this symbol name himself, in which case (IIRC
>> the BFD ld behavior) the user's symbol should be wholly unmolested (but it
>> might be that BFD ld uses the user's value but marks it STV_HIDDEN
>> anyway--I'm not sure).
> I don't know why __ehdr_start is defined in Layout::finalize.  As you
> suggest, it should be defined by define_standard_symbols instead,
> setting the only_if_ref field to true.  If necessary, Layout::finalize
> can adjust the symbol value using init_output_segment, but only if the
> symbol is marked as predefined.  Layout::finalize can simply look up
> the symbol by name.

The attached patch should fix this. Can you give it a try, and if it
works, I'll add a testcase and check it in.


2014-03-31  Cary Coutant  <>

        * gold/ (in_segment): Define __ehdr_start here...
        * gold/ (Layout::finalize): ...Instead of here.  Set the
        output segment when known.
        * gold/ (Symbol::set_output_segment): New function.
        * gold/symtab.h (Symbol::set_output_segment): New function.

Attachment: ehdr-start-patch.txt
Description: Text document

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