diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-04-21 12:03:14 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-04-21 12:03:26 -0700 |
commit | e133d00576f3da89e7772149e8d2b6a059d26919 (patch) | |
tree | b1ac9f41d4f96706a1806d54cf45095651d0b811 /ld | |
parent | 3c5fce9bc29b216af7d10f8d6e4d8c3f11a48359 (diff) | |
download | gdb-e133d00576f3da89e7772149e8d2b6a059d26919.zip gdb-e133d00576f3da89e7772149e8d2b6a059d26919.tar.gz gdb-e133d00576f3da89e7772149e8d2b6a059d26919.tar.bz2 |
i386: Avoid dynamic symbol with GOT reference in PIE
GOT reference to global symbol in PIE will lead to dynamic symbol. It
becomes a problem when "time" or "times" is defined as a variable in
an executable, clashing with functions of the same name in libc. If
a symbol isn't undefined weak symbol, don't make it dynamic in PIE and
generate R_386_RELATIVE relocation.
bfd/
PR ld/21402
* elf32-i386.c (elf_i386_link_hash_entry): Add
no_finish_dynamic_symbol.
(elf_i386_link_hash_newfunc): Set no_finish_dynamic_symbol to 0.
(elf_i386_allocate_dynrelocs): If a symbol isn't undefined weak
symbol, don't make it dynamic in PIE.
(elf_i386_relocate_section): If a symbol isn't dynamic in PIE,
set no_finish_dynamic_symbol and generate R_386_RELATIVE
relocation for R_386_GOT32
(elf_i386_finish_dynamic_symbol): Abort if no_finish_dynamic_symbol
isn't 0.
ld/
PR ld/21402
* testsuite/ld-elf/indirect.exp: Don't skip PIE indirect5 and
indirect6 tests on i386.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/indirect.exp | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 86d9e51..c6daa9a 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,11 @@ 2017-04-21 H.J. Lu <hongjiu.lu@intel.com> + PR ld/21402 + * testsuite/ld-elf/indirect.exp: Don't skip PIE indirect5 and + indirect6 tests on i386. + +2017-04-21 H.J. Lu <hongjiu.lu@intel.com> + PR ld/19617 PR ld/21086 * testsuite/ld-elf/pr19617a.d: Pass --no-dynamic-linker to ld. diff --git a/ld/testsuite/ld-elf/indirect.exp b/ld/testsuite/ld-elf/indirect.exp index 2fa374b..fd7d189 100644 --- a/ld/testsuite/ld-elf/indirect.exp +++ b/ld/testsuite/ld-elf/indirect.exp @@ -222,11 +222,6 @@ foreach t [list indirect5a indirect5b indirect6a indirect6b] { } } -# PR ld/21402: i386 doesn't support mixing different symbol types in PIE. -if {[istarget "i?86-*-*"]} { - return -} - send_log "$CC -fPIE -pie $srcdir/$subdir/main.c -o tmpdir/pie" catch "exec $CC -fPIE -pie $srcdir/$subdir/main.c -o tmpdir/pie" exec_output send_log "$exec_output" |