This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb/binutils-2_32-branch] x86: Also check x86 linker_def for non-shared definition
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 17 Apr 2019 16:19:49 -0000
- Subject: [binutils-gdb/binutils-2_32-branch] x86: Also check x86 linker_def for non-shared definition
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=49364d83d58d6357aa0fcd1b448b48218d244675
commit 49364d83d58d6357aa0fcd1b448b48218d244675
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Apr 17 09:08:46 2019 -0700
x86: Also check x86 linker_def for non-shared definition
Since elf_x86_linker_defined sets linker_def in elf_x86_link_hash_entry
for linker defined symbols, SYMBOL_DEFINED_NON_SHARED_P should also check
linker_def in elf_x86_link_hash_entry.
bfd/
PR ld/24458
* elfxx-x86.h (SYMBOL_DEFINED_NON_SHARED_P): Also check x86
linker_def.
ld/
PR ld/24458
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/24458 tests.
* testsuite/ld-x86-64/pr24458.s: New file.
* testsuite/ld-x86-64/pr24458a-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458a.d: Likewise.
* testsuite/ld-x86-64/pr24458b-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458b.d: Likewise.
* testsuite/ld-x86-64/pr24458c-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458c.d: Likewise.
(cherry picked from commit 4e84a8f8bbeab52fa7048873655e582ceb92534d)
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/elfxx-x86.h | 1 +
ld/ChangeLog | 12 ++++++++++++
ld/testsuite/ld-x86-64/pr24458.s | 5 +++++
ld/testsuite/ld-x86-64/pr24458a-x32.d | 10 ++++++++++
ld/testsuite/ld-x86-64/pr24458a.d | 10 ++++++++++
ld/testsuite/ld-x86-64/pr24458b-x32.d | 10 ++++++++++
ld/testsuite/ld-x86-64/pr24458b.d | 10 ++++++++++
ld/testsuite/ld-x86-64/pr24458c-x32.d | 10 ++++++++++
ld/testsuite/ld-x86-64/pr24458c.d | 10 ++++++++++
ld/testsuite/ld-x86-64/x86-64.exp | 6 ++++++
11 files changed, 90 insertions(+)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6433e46..45255c0 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2019-04-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/24458
+ * elfxx-x86.h (SYMBOL_DEFINED_NON_SHARED_P): Also check x86
+ linker_def.
+
2019-03-25 Claudiu Zissulescu <claziss@synopsys.com>
Backport from mainline
diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h
index 28d540b..610b2f3 100644
--- a/bfd/elfxx-x86.h
+++ b/bfd/elfxx-x86.h
@@ -166,6 +166,7 @@
((H)->def_regular \
|| (H)->root.linker_def \
|| (H)->root.ldscript_def \
+ || ((struct elf_x86_link_hash_entry *) (H))->linker_def \
|| ELF_COMMON_DEF_P (H))
/* TRUE if relative relocation should be generated. GOT reference to
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 192599f..f4b12a2 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,15 @@
+2019-04-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/24458
+ * testsuite/ld-x86-64/x86-64.exp: Run PR ld/24458 tests.
+ * testsuite/ld-x86-64/pr24458.s: New file.
+ * testsuite/ld-x86-64/pr24458a-x32.d: Likewise.
+ * testsuite/ld-x86-64/pr24458a.d: Likewise.
+ * testsuite/ld-x86-64/pr24458b-x32.d: Likewise.
+ * testsuite/ld-x86-64/pr24458b.d: Likewise.
+ * testsuite/ld-x86-64/pr24458c-x32.d: Likewise.
+ * testsuite/ld-x86-64/pr24458c.d: Likewise.
+
2019-04-01 Tamar Christina <tamar.christina@arm.com>
* testsuite/ld-arm/jump-reloc-veneers-cond-long.d: Update disassembly.
diff --git a/ld/testsuite/ld-x86-64/pr24458.s b/ld/testsuite/ld-x86-64/pr24458.s
new file mode 100644
index 0000000..7dbd47a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24458.s
@@ -0,0 +1,5 @@
+ .text
+ .globl _start
+ .type _start, @function
+_start:
+ movq __ehdr_start(%rip), %rax
diff --git a/ld/testsuite/ld-x86-64/pr24458a-x32.d b/ld/testsuite/ld-x86-64/pr24458a-x32.d
new file mode 100644
index 0000000..ae3994a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24458a-x32.d
@@ -0,0 +1,10 @@
+#source: pr24458.s
+#as: --x32 -mx86-used-note=yes
+#ld: -m elf32_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: <None>
+ x86 feature used: x86
diff --git a/ld/testsuite/ld-x86-64/pr24458a.d b/ld/testsuite/ld-x86-64/pr24458a.d
new file mode 100644
index 0000000..9e2e8b0
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24458a.d
@@ -0,0 +1,10 @@
+#source: pr24458.s
+#as: --64 -mx86-used-note=yes
+#ld: -m elf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: <None>
+ x86 feature used: x86
diff --git a/ld/testsuite/ld-x86-64/pr24458b-x32.d b/ld/testsuite/ld-x86-64/pr24458b-x32.d
new file mode 100644
index 0000000..57d10ab
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24458b-x32.d
@@ -0,0 +1,10 @@
+#source: pr24458.s
+#as: --x32 -mx86-used-note=yes
+#ld: -pie -m elf32_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: <None>
+ x86 feature used: x86
diff --git a/ld/testsuite/ld-x86-64/pr24458b.d b/ld/testsuite/ld-x86-64/pr24458b.d
new file mode 100644
index 0000000..bdcc79a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24458b.d
@@ -0,0 +1,10 @@
+#source: pr24458.s
+#as: --64 -mx86-used-note=yes
+#ld: -pie -m elf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: <None>
+ x86 feature used: x86
diff --git a/ld/testsuite/ld-x86-64/pr24458c-x32.d b/ld/testsuite/ld-x86-64/pr24458c-x32.d
new file mode 100644
index 0000000..4d76636
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24458c-x32.d
@@ -0,0 +1,10 @@
+#source: pr24458.s
+#as: --x32 -mx86-used-note=yes
+#ld: -shared -m elf32_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: <None>
+ x86 feature used: x86
diff --git a/ld/testsuite/ld-x86-64/pr24458c.d b/ld/testsuite/ld-x86-64/pr24458c.d
new file mode 100644
index 0000000..e299831
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24458c.d
@@ -0,0 +1,10 @@
+#source: pr24458.s
+#as: --64 -mx86-used-note=yes
+#ld: -shared -m elf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: <None>
+ x86 feature used: x86
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 5eb5565..9a76486 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -426,6 +426,12 @@ run_dump_test "pr23930"
run_dump_test "pr23930-x32"
run_dump_test "pr24151a"
run_dump_test "pr24151a-x32"
+run_dump_test "pr24458a"
+run_dump_test "pr24458a-x32"
+run_dump_test "pr24458b"
+run_dump_test "pr24458b-x32"
+run_dump_test "pr24458c"
+run_dump_test "pr24458c-x32"
if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
return