aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2014-11-18 11:03:09 -0800
committerH.J. Lu <hjl.tools@gmail.com>2014-11-18 11:04:46 -0800
commitab7fede88eddf004994f8769e3c7ac145628f5b4 (patch)
tree85688a9f445489647b2750bd597da68327037c7a /ld
parent439247b656ce3bcfaa00fec7dbce70e65ca17cf5 (diff)
downloadgdb-ab7fede88eddf004994f8769e3c7ac145628f5b4.zip
gdb-ab7fede88eddf004994f8769e3c7ac145628f5b4.tar.gz
gdb-ab7fede88eddf004994f8769e3c7ac145628f5b4.tar.bz2
Check PC-relative offset overflow in PLT entry
This patch checks PC-relative offset overflow in pushq instruction in x86-64 PLT entry. bfd/ PR ld/17618 * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Check PC-relative offset overflow in PLT entry. ld/testsuite/ PR ld/17618 * ld-x86-64/x86-64.exp: Run pr17618 for Linux target. * ld-x86-64/pr17618.d: New file. * ld-x86-64/pr17618.s: Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog8
-rw-r--r--ld/testsuite/ld-x86-64/pr17618.d4
-rw-r--r--ld/testsuite/ld-x86-64/pr17618.s18
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp7
4 files changed, 37 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index a8aa37d..72b4bb9 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,13 @@
2014-11-18 H.J. Lu <hongjiu.lu@intel.com>
+ PR ld/17618
+ * ld-x86-64/x86-64.exp: Run pr17618 for Linux target.
+
+ * ld-x86-64/pr17618.d: New file.
+ * ld-x86-64/pr17618.s: Likewise.
+
+2014-11-18 H.J. Lu <hongjiu.lu@intel.com>
+
* ld-x86-64/mpx.exp: Always run mpx3 and mpx4 tests in 64-bit.
2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com>
diff --git a/ld/testsuite/ld-x86-64/pr17618.d b/ld/testsuite/ld-x86-64/pr17618.d
new file mode 100644
index 0000000..e640b40
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr17618.d
@@ -0,0 +1,4 @@
+#name: PLT PC-relative offset overflow check
+#as: --64
+#ld: -shared -melf_x86_64
+#error: .*PC-relative offset overflow in PLT entry for `bar'
diff --git a/ld/testsuite/ld-x86-64/pr17618.s b/ld/testsuite/ld-x86-64/pr17618.s
new file mode 100644
index 0000000..39102e0
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr17618.s
@@ -0,0 +1,18 @@
+ .text
+ .globl foo
+ .type foo, @function
+foo:
+ call bar@PLT
+ .size foo, .-foo
+
+ .globl gap
+ .type gap, @function
+gap:
+ jmp .L0
+ .space 0x40000000, 0x90
+.L0:
+ jmp .L2
+ .space 0x3fdfff14, 0x90
+.L2:
+ .size gap, .-gap
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index a9b68ff..7f09458 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -333,3 +333,10 @@ if { [isnative] && [which $CC] != 0 } {
{dummy.s} {{readelf {-s --wide} x86-64-x32.rd}} "x86-64-x32"}
}
}
+
+if { ![istarget "x86_64-*-linux*"]} {
+ return
+}
+
+# Linux only tests
+run_dump_test "pr17618"