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]

[gold patch] PR gold/13249: Fix RELATIVE relocs for IFUNC symbols


This patch fixes PR gold/13249, where gold provides the wrong addend
field for RELATIVE relocations for references to IFUNC symbols. I
added a use_plt_offset field to the Output_reloc class, and pass that
flag from the target-specific Scan::local routine through
Output_data_reloc::add_local_relative. If the flag is set, the
relocation will put the address of the PLT entry into the addend field
(instead of the value of the IFUNC symbol), to match the value
statically written to the GOT entry or function pointer.

Tested on x86_64, also builds for sparc and powerpc targets. OK to commit?

-cary


	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.

Attachment: gold-ifuncmain7pie-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]