This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Add a testcase for PR ld/22269
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: binutils at sourceware dot org
- Date: Sat, 7 Oct 2017 04:20:21 -0700
- Subject: [PATCH] Add a testcase for PR ld/22269
- Authentication-results: sourceware.org; auth=none
Since undefined weak symbols in static PE are always resolved to 0 at
run-time, linker should resolve them as 0 at link-time. This test
currently passes 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
I will submit backend patches for failling targets.
OK for master.
H.J.
PR ld/22269
* testsuite/ld-elf/pr22269.d: New file.
* testsuite/ld-elf/pr22269.s:
---
ld/testsuite/ld-elf/pr22269.d | 9 +++++++++
ld/testsuite/ld-elf/pr22269.s | 13 +++++++++++++
2 files changed, 22 insertions(+)
create mode 100644 ld/testsuite/ld-elf/pr22269.d
create mode 100644 ld/testsuite/ld-elf/pr22269.s
diff --git a/ld/testsuite/ld-elf/pr22269.d b/ld/testsuite/ld-elf/pr22269.d
new file mode 100644
index 0000000000..2a01b86d79
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr22269.d
@@ -0,0 +1,9 @@
+#name: PR ld/22269
+#ld: -pie --no-dynamic-linker
+#readelf: -r -x .data.rel.ro
+#target: *-*-linux* *-*-gnu*
+
+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/pr22269.s b/ld/testsuite/ld-elf/pr22269.s
new file mode 100644
index 0000000000..71c1c06eea
--- /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
--
2.13.6