This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold patch] PR gold/13249: Fix RELATIVE relocs for IFUNC symbols
- From: Ian Lance Taylor <iant at google dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Sun, 09 Oct 2011 21:52:30 -0700
- Subject: Re: [gold patch] PR gold/13249: Fix RELATIVE relocs for IFUNC symbols
- References: <CAHACq4p_mETf2Km+T-VCHOZ701MWuJ7FcOTu7ZJWv-VD=sLa=w@mail.gmail.com>
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