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 patch] PR gold/13249: Fix RELATIVE relocs for IFUNC symbols

Cary Coutant <> writes:

> 	PR gold/13249
> 	* gold/ (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/ (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

>    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.


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