summaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-10-07 03:07:36 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-10-11 13:44:16 -0700
commit4b97e3893ed2af7bdb9dcaa34fae1a207e2d7042 (patch)
tree859b1329697f6830a1ca3b692d434130cb4f17dd /ld
parent853ee16fcdf7e60f297b3456353b3a69f4822bec (diff)
downloadbinutils-gdb-4b97e3893ed2af7bdb9dcaa34fae1a207e2d7042.tar.gz
Add 2 testcases for PR ld/22269
Since undefined weak symbols in static PIE are always resolved to 0 at run-time, linker should resolve them as 0 at link-time, regardless of whether "-z dynamic-undefined-weak" is used. "-z dynamic-undefined-weak" only makes undefined weak symbols dynamic, but doesn't change undefined weak symbol resolution in static PIE at link-time. These tests currently pass on x86, but fails on many other targets. The framework to resolve weak symbols in static PE at link-time is posted at https://sourceware.org/ml/binutils/2017-10/msg00087.html which requires users/hjl/check_relocs branch to call check_relocs after opening all inputs. I will submit backend patches for failling targets after merging users/hjl/check_relocs branch next. * PR ld/22269 * testsuite/ld-elf/pr22269.s: New file. * testsuite/ld-elf/pr22269a.d: Likewise. * testsuite/ld-elf/pr22269b.d: Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/testsuite/ld-elf/pr22269.s13
-rw-r--r--ld/testsuite/ld-elf/pr22269a.d10
-rw-r--r--ld/testsuite/ld-elf/pr22269b.d10
4 files changed, 40 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 17192529fed..43fa479b727 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,12 @@
2017-10-11 H.J. Lu <hongjiu.lu@intel.com>
+ * PR ld/22269
+ * testsuite/ld-elf/pr22269.s: New file.
+ * testsuite/ld-elf/pr22269a.d: Likewise.
+ * testsuite/ld-elf/pr22269b.d: Likewise.
+
+2017-10-11 H.J. Lu <hongjiu.lu@intel.com>
+
* testsuite/ld-i386/i386.exp: Run pr19636-1j, pr19636-1k,
pr19636-1l, pr19636-3h and pr19636-3i.
* testsuite/ld-i386/pr19636-1j.d: New file.
diff --git a/ld/testsuite/ld-elf/pr22269.s b/ld/testsuite/ld-elf/pr22269.s
new file mode 100644
index 00000000000..71c1c06eeae
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr22269.s
@@ -0,0 +1,13 @@
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .byte 0
+ .section .data.rel.ro.local,"aw",%progbits
+ .weak func
+ .dc.a func
diff --git a/ld/testsuite/ld-elf/pr22269a.d b/ld/testsuite/ld-elf/pr22269a.d
new file mode 100644
index 00000000000..d993d19ba50
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr22269a.d
@@ -0,0 +1,10 @@
+#name: PR ld/22269
+#source: pr22269.s
+#ld: -pie --no-dynamic-linker
+#readelf: -r -x .data.rel.ro
+#target: *-*-linux* *-*-gnu* *-*-nacl*
+
+There are no relocations in this file.
+
+Hex dump of section '.data.rel.ro':
+ 0x[a-f0-9]+ [0 ]+[ ]+.+
diff --git a/ld/testsuite/ld-elf/pr22269b.d b/ld/testsuite/ld-elf/pr22269b.d
new file mode 100644
index 00000000000..8810922e7a3
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr22269b.d
@@ -0,0 +1,10 @@
+#name: PR ld/22269 (-z dynamic-undefined-weak)
+#source: pr22269.s
+#ld: -pie --no-dynamic-linker -z dynamic-undefined-weak
+#readelf: -r -x .data.rel.ro
+#target: *-*-linux* *-*-gnu* *-*-nacl*
+
+There are no relocations in this file.
+
+Hex dump of section '.data.rel.ro':
+ 0x[a-f0-9]+ [0 ]+[ ]+.+