This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB 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]

[binutils-gdb] DT_TEXTREL vs IFUNC


*** TEST RESULTS FOR COMMIT 82e66161e649e5e801c40a52cba759292a76a59a ***

Author: Alan Modra <amodra@gmail.com>
Branch: master
Commit: 82e66161e649e5e801c40a52cba759292a76a59a

DT_TEXTREL vs IFUNC

If you should somehow link non-pic objects into a PIE or shared
library, resulting in an object with DT_TEXTREL (text relocations)
set, and your executable or shared library also contains GNU indirect
functions, then you're in trouble.  To apply dynamic relocations
ld.so will make the text segment writable.  On most systems this will
make the text segment non-executable, which will then result in a
segfault when ld.so tries to run ifunc resolvers when applying
relocations against ifuncs.

This patch teaches PowerPC ld to detect the situation, and warn.

	* elf64-ppc.c (struct ppc_link_hash_table): Add
	local_ifunc_resolver and maybe_local_ifunc_resolver.
	(ppc_build_one_stub): Set flags on emitting dynamic
	relocation to ifunc.
	(ppc64_elf_relocate_section): Likewise.
	(ppc64_elf_finish_dynamic_symbol): Likewise.
	(ppc64_elf_finish_dynamic_sections): Error on DT_TEXTREL with
	local dynamic relocs to ifuncs.
	* elf32-ppc.c (struct ppc_elf_link_hash_table): Add
	local_ifunc_resolver and maybe_local_ifunc_resolver.
	(ppc_elf_relocate_section): Set flag on emitting dynamic
	relocation to ifuncs.
	(ppc_elf_finish_dynamic_symbol): Likewise.
	(ppc_elf_finish_dynamic_sections): Error on DT_TEXTREL with local
	dynamic relocs to ifuncs.


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