aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-01-15 11:06:33 -0800
committerH.J. Lu <hjl.tools@gmail.com>2015-01-15 11:08:59 -0800
commit6333bc0dd6e92dd5a76ba0a6890e08db2a6f7a29 (patch)
treee63abc4928496451a64b4eac09e5a780ddb716b8 /ld
parentd221e7efd61fc80f6fbf862b7e32927835575329 (diff)
downloadgdb-6333bc0dd6e92dd5a76ba0a6890e08db2a6f7a29.zip
gdb-6333bc0dd6e92dd5a76ba0a6890e08db2a6f7a29.tar.gz
gdb-6333bc0dd6e92dd5a76ba0a6890e08db2a6f7a29.tar.bz2
Don't complain about -fPIC for undefined symbol
When building executable, undefined symbol is a fatal error. We don't complain about -fPIC if the symbol is undefined. bfd/ PR ld/17847 * elf64-x86-64.c (elf_x86_64_relocate_section): Don't complain about -fPIC if the symbol is undefined when building executable. ld/testsuite/ PR ld/17847 * ld-x86-64/pie1.d: New file. * ld-x86-64/pie1.s: Likwise. * ld-x86-64/x86-64.exp: Run pie1.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog7
-rw-r--r--ld/testsuite/ld-x86-64/pie1.d9
-rw-r--r--ld/testsuite/ld-x86-64/pie1.s4
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp1
4 files changed, 21 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 3ab61c7..58e5595 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2015-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/17847
+ * ld-x86-64/pie1.d: New file.
+ * ld-x86-64/pie1.s: Likwise.
+ * ld-x86-64/x86-64.exp: Run pie1.
+
2015-01-13 Thomas Preud'homme <thomas.preudhomme@arm.com>
* ld-aarch64/aarch64-elf.exp: Added relocs-257-symbolic-func test.
diff --git a/ld/testsuite/ld-x86-64/pie1.d b/ld/testsuite/ld-x86-64/pie1.d
new file mode 100644
index 0000000..06d2562
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pie1.d
@@ -0,0 +1,9 @@
+#name: PIE with undefined symbol
+#as: --64
+#ld: -pie -melf_x86_64 --noinhibit-exec
+#readelf: -s --wide
+#warning: \A[^\n]*\.o[^\n]*In function `_start':\n[^\n]*: undefined reference to `foo'\Z
+
+#...
+ +[0-9]+: +[0-9a-f]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND foo
+#pass
diff --git a/ld/testsuite/ld-x86-64/pie1.s b/ld/testsuite/ld-x86-64/pie1.s
new file mode 100644
index 0000000..94c59cb
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pie1.s
@@ -0,0 +1,4 @@
+ .text
+ .global _start
+_start:
+ movl foo(%rip), %eax
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 5b49bff..bfa89c3 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -228,6 +228,7 @@ run_dump_test "pr12570b"
run_dump_test "pr14215"
run_dump_test "pr14207"
run_dump_test "gotplt1"
+run_dump_test "pie1"
if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
return