diff options
author | Alan Modra <amodra@gmail.com> | 2017-03-17 08:37:15 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2017-03-18 08:38:15 +1030 |
commit | 82e66161e649e5e801c40a52cba759292a76a59a (patch) | |
tree | 36a2ed05b7811ffcc8b4adcc8993433e18728fdd /bfd/ChangeLog | |
parent | d9cb6cdcfa12368f2f639f8cd06d18b94bd98a39 (diff) | |
download | gdb-82e66161e649e5e801c40a52cba759292a76a59a.zip gdb-82e66161e649e5e801c40a52cba759292a76a59a.tar.gz gdb-82e66161e649e5e801c40a52cba759292a76a59a.tar.bz2 |
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.
Diffstat (limited to 'bfd/ChangeLog')
-rw-r--r-- | bfd/ChangeLog | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 664285b..5dea352 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,21 @@ +2017-03-18 Alan Modra <amodra@gmail.com> + + * 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. + 2017-03-13 Nick Clifton <nickc@redhat.com> PR binutils/21202 |