aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-i386
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-04-26 15:34:00 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-04-26 15:34:00 -0700
commit97d343d40012b1030f1fd219f91efcab180fb3ef (patch)
treecde57d6b3f72a3b262066a0588833f2b8082599c /ld/testsuite/ld-i386
parent04b31182bf3f8a1a76e995bdfaaaab4c009b9cb2 (diff)
downloadgdb-97d343d40012b1030f1fd219f91efcab180fb3ef.zip
gdb-97d343d40012b1030f1fd219f91efcab180fb3ef.tar.gz
gdb-97d343d40012b1030f1fd219f91efcab180fb3ef.tar.bz2
x86: Add DT_PLTRELSZ/DT_PLTREL/DT_JMPREL for PLT relocation
x86, PLT relocation may contain R_386_TLS_DESC or R_X86_64_TLSDESC even though there is no real PLT. We need to add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL if there is a .rel.plt/.rela.plt section. bfd/ * elf32-i386.c (elf_i386_size_dynamic_sections): Alwasys add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rel.plt section. * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Alwasys add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rela.plt section. ld/ * testsuite/ld-i386/tlsdesc2.d: New test. * testsuite/ld-x86-64/tlsdesc2.d: Likewise.
Diffstat (limited to 'ld/testsuite/ld-i386')
-rw-r--r--ld/testsuite/ld-i386/i386.exp1
-rw-r--r--ld/testsuite/ld-i386/tlsdesc2.d10
2 files changed, 11 insertions, 0 deletions
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 844b36f..a709bcf 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -437,6 +437,7 @@ run_dump_test "pr18801"
run_dump_test "pr18815"
run_dump_test "pr19939a"
run_dump_test "pr19939b"
+run_dump_test "tlsdesc2"
proc undefined_weak {cflags ldflags} {
set testname "Undefined weak symbol"
diff --git a/ld/testsuite/ld-i386/tlsdesc2.d b/ld/testsuite/ld-i386/tlsdesc2.d
new file mode 100644
index 0000000..b8569e8
--- /dev/null
+++ b/ld/testsuite/ld-i386/tlsdesc2.d
@@ -0,0 +1,10 @@
+#source: tlsdesc.s
+#as: --32
+#ld: -melf_i386 -shared -z now
+#readelf: -d --wide
+
+#...
+.*\(PLTRELSZ\).*
+.*\(PLTREL\).*
+.*\(JMPREL\).*
+#pass