aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-06-24 13:37:05 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-06-24 13:47:37 -0700
commit7c1e8d3ed5e48b3339d60450fdb5b29ae54edebe (patch)
treece3e0e7af01292717cbefddead2daf16038c4b74 /ld
parentf91ca6bc00c1e3c70c1d2f4527d4297b76e2eaca (diff)
downloadgdb-7c1e8d3ed5e48b3339d60450fdb5b29ae54edebe.zip
gdb-7c1e8d3ed5e48b3339d60450fdb5b29ae54edebe.tar.gz
gdb-7c1e8d3ed5e48b3339d60450fdb5b29ae54edebe.tar.bz2
Keep .plt section and DT_PLTGOT for prelink
Since the .plt section and DT_PLTGOT are used by prelink to undo prelinking for dynamic relocations, we must keep them even if there is no PLT relocation. This patch reverted commit a3747075a. bfd/ * elf32-i386.c (elf_i386_allocate_dynrelocs): Always allocate space for the first .plt entry. (elf_i386_size_dynamic_sections): Always add DT_PLTGOT for .plt section. Add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL only if there are PLT relocations. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Always allocate space for the first .plt entry. (elf_x86_64_size_dynamic_sections): Always add DT_PLTGOT for .plt section. Add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL only if there are PLT relocations. ld/testsuite/ * ld-i386/i386.exp: Run pltgot-2 for Linux targets. * ld-x86-64/x86-64.exp: Likewise. * ld-i386/pltgot-1.d: Updated. * ld-x86-64/pltgot-1.d: Likewise. * ld-i386/pltgot-2.d: New file. * ld-x86-64/pltgot-2.d: Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog9
-rw-r--r--ld/testsuite/ld-i386/i386.exp1
-rw-r--r--ld/testsuite/ld-i386/pltgot-1.d5
-rw-r--r--ld/testsuite/ld-i386/pltgot-2.d9
-rw-r--r--ld/testsuite/ld-x86-64/pltgot-1.d5
-rw-r--r--ld/testsuite/ld-x86-64/pltgot-2.d9
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp1
7 files changed, 35 insertions, 4 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 812549c..2031bc8 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2015-06-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-i386/i386.exp: Run pltgot-2 for Linux targets.
+ * ld-x86-64/x86-64.exp: Likewise.
+ * ld-i386/pltgot-1.d: Updated.
+ * ld-x86-64/pltgot-1.d: Likewise.
+ * ld-i386/pltgot-2.d: New file.
+ * ld-x86-64/pltgot-2.d: Likewise.
+
2015-06-23 Jiong Wang <jiong.wang@arm.com>
* ld-aarch64/dt_textrel.s: New testcase.
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index a26cffd..61f9599 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -525,3 +525,4 @@ if { !([istarget "i?86-*-linux*"]
# Linux only tests
run_dump_test "pltgot-1"
+run_dump_test "pltgot-2"
diff --git a/ld/testsuite/ld-i386/pltgot-1.d b/ld/testsuite/ld-i386/pltgot-1.d
index 6629635..165ae33 100644
--- a/ld/testsuite/ld-i386/pltgot-1.d
+++ b/ld/testsuite/ld-i386/pltgot-1.d
@@ -2,7 +2,8 @@
#readelf: -S --wide
#as: --32
-#failif
#...
- +\[ [0-9]+\] \.plt +PROGBITS +.*
+ +\[ *[0-9]+\] \.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+10 +.*
#...
+ +\[ *[0-9]+\] \.got\.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+c +.*
+#pass
diff --git a/ld/testsuite/ld-i386/pltgot-2.d b/ld/testsuite/ld-i386/pltgot-2.d
new file mode 100644
index 0000000..3b87898
--- /dev/null
+++ b/ld/testsuite/ld-i386/pltgot-2.d
@@ -0,0 +1,9 @@
+#source: pltgot-1.s
+#ld: -shared -melf_i386
+#readelf: -d --wide
+#as: --32
+
+#failif
+#...
+ +0x[0-9a-f]+ +\(PLTREL.*
+#...
diff --git a/ld/testsuite/ld-x86-64/pltgot-1.d b/ld/testsuite/ld-x86-64/pltgot-1.d
index 9a6c2fd6..17d4f43 100644
--- a/ld/testsuite/ld-x86-64/pltgot-1.d
+++ b/ld/testsuite/ld-x86-64/pltgot-1.d
@@ -2,7 +2,8 @@
#readelf: -S --wide
#as: --64
-#failif
#...
- +\[ [0-9]+\] \.plt +PROGBITS +.*
+ +\[ *[0-9]+\] \.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+10 +.*
#...
+ +\[ *[0-9]+\] \.got\.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+18 +.*
+#pass
diff --git a/ld/testsuite/ld-x86-64/pltgot-2.d b/ld/testsuite/ld-x86-64/pltgot-2.d
new file mode 100644
index 0000000..086d6dd
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pltgot-2.d
@@ -0,0 +1,9 @@
+#source: pltgot-1.s
+#ld: -shared -melf_x86_64
+#readelf: -d --wide
+#as: --64
+
+#failif
+#...
+ +0x[0-9a-f]+ +\(PLTREL.*
+#...
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 8281dc4..3669446 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -574,3 +574,4 @@ if { ![istarget "x86_64-*-linux*"]} {
# Linux only tests
run_dump_test "pr17618"
run_dump_test "pltgot-1"
+run_dump_test "pltgot-2"