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: [RFC] [gold] Simplify relocation strategy logic


Cary Coutant <ccoutant@google.com> writes:
>> In that case, you're changing the meaning of the flags, so I think
>> you'll need to adjust all other ports as well the comment. ÂThe current
>> code really was written to the current definition of ABSOLUTE_REF.
>
> Are you sure? It looks to me like Symbol::needs_dynamic_reloc()
> assumes that ABSOLUTE_REF describes the location being relocated
> rather than the GOT entry that is created as a by-product.

Well, I don't know how much it counts for, but I know I was deliberately
following that model when doing the get_reference_flags() stuff. :-)

I agree it's confusing[*], but as things stand, I don't think
Symbol::needs_dynamic_reloc() inherently assumes what you say.
It depends on the calling context.  If you wanted to call
Symbol::needs_dynamic_reloc() directly from relocate() to decide
whether a GOT reloc itself needs to become dynamic, then yes,
the function would give the wrong answer.  But nothing calls
the function in that context, because GOT relocs themselves
are always resolved statically.  The only question is whether
the GOT _entry_ needs a reloc.

The case where Symbol::needs_dynamic_reloc() _does_ need to describe
the GOT entry itself is for the current definition of use_plt_offset().
That function is called for all relocations (including GOT relocations)
at the beginning of the target's relocate() function.  In the case of
GOT relocs, use_plt_offset() says whether the _GOT entry_ should be
redirected to the PLT.  (This is of course sometimes true for ifuncs,
but should never be true otherwise.)  So I claim that, in the context
of use_plt_offset(), needs_dynamic_reloc() really is telling you about
the GOT entry rather than the GOT reloc itself.

I hope I'm remembering this right...

Richard

[*] and I'd like to think that the confusion predates my changes. :-)
    Don't get me wrong, your plans to clean this up are very welcome to me.
    I just dispute that the current code is wrong.


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