[gold patch] PR gold/13249: Fix RELATIVE relocs for IFUNC symbols
Ian Lance Taylor
iant@google.com
Mon Oct 10 04:52:00 GMT 2011
Cary Coutant <ccoutant@google.com> writes:
> PR gold/13249
> * gold/output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
> (Output_reloc::symbol_value): Return PLT offset if flag is set.
> * gold/output.h (class Output_reloc): Add use_plt_offset flag.
> (Output_reloc::type_): Adjust size of bit field.
> (Output_reloc::use_plt_offset_): New bit field.
> (class Output_data_reloc): Adjust all calls to Output_reloc_type.
> (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
> flag. Adjust all callers.
> * gold/x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
> creating RELATIVE relocations.
> + // True if the addend should be the PLT offset.
> + // (Used only for RELA, but stored here for space.)
> + bool use_plt_offset_ : 1;
Your code only checks this for a local symbol. The comment should say
that.
> const Symbol_value<size>* symval = relobj->local_symbol(lsi);
> + if (this->use_plt_offset_)
> + {
> + uint64_t plt_address =
> + parameters->target().plt_address_for_local(relobj, lsi);
> + return plt_address + relobj->local_plt_offset(lsi);
> + }
> return symval->value(relobj, addend);
You might as well move the declaration and initialization of symval
after the test of this->use_plt_offset_.
This is OK with those changes.
Thanks for tracking this down.
Ian
More information about the Binutils
mailing list