This is the mail archive of the
gdb-testers@sourceware.org
mailing list for the GDB project.
[binutils-gdb] DT_TEXTREL vs IFUNC
- From: sergiodj+buildbot at sergiodj dot net
- To: gdb-testers at sourceware dot org
- Date: Wed, 22 Mar 2017 15:37:19 -0400
- Subject: [binutils-gdb] DT_TEXTREL vs IFUNC
- Authentication-results: sourceware.org; auth=none
*** 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.