aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-10-26 16:32:34 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-10-26 16:32:55 -0700
commit7b7e7f1da28585cfa49cbced50dbbd75a143cd20 (patch)
tree92bc4519ea2dc65f76bd4d2d8280c3857ef55d42 /ld/testsuite
parent0fde2c536bc483baa4baa2990ebebfb3a7c00415 (diff)
downloadfsf-binutils-gdb-7b7e7f1da28585cfa49cbced50dbbd75a143cd20.zip
fsf-binutils-gdb-7b7e7f1da28585cfa49cbced50dbbd75a143cd20.tar.gz
fsf-binutils-gdb-7b7e7f1da28585cfa49cbced50dbbd75a143cd20.tar.bz2
Check symbol defined by assignment in linker script
Symbol symbol defined by an assignment in a linker script has type bfd_link_hash_new. elf_i386_convert_load and elf_x86_64_convert_load should check bfd_link_hash_new to see if a symbol is defined by a linker script. bfd/ PR ld/19175 * elf32-i386.c (elf_i386_convert_load): Check bfd_link_hash_new instead of calling bfd_link_get_defined_symbol. * elf64-x86-64.c (elf_x86_64_convert_load): Likewise. Skip relocation overflow for bfd_link_hash_new. * linker.c (bfd_link_get_defined_symbol): Removed. * bfd-in2.h: Regenerated. ld/testsuite/ PR ld/19175 * ld-i386/i386.exp: Run pr19175. * ld-x86-64/x86-64.exp: Likewise. * ld-i386/pr19175.d: New file. * ld-i386/pr19175.s: Likewise. * ld-i386/pr19175.t: Likewise. * ld-x86-64/pr19175.d: Likewise. * ld-x86-64/pr19175.s: Likewise. * ld-x86-64/pr19175.t: Likewise.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog12
-rw-r--r--ld/testsuite/ld-i386/i386.exp1
-rw-r--r--ld/testsuite/ld-i386/pr19175.d13
-rw-r--r--ld/testsuite/ld-i386/pr19175.s5
-rw-r--r--ld/testsuite/ld-i386/pr19175.t11
-rw-r--r--ld/testsuite/ld-x86-64/pr19175.d13
-rw-r--r--ld/testsuite/ld-x86-64/pr19175.s5
-rw-r--r--ld/testsuite/ld-x86-64/pr19175.t11
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp1
9 files changed, 72 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 42558ba..7946644 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,17 @@
2015-10-26 H.J. Lu <hongjiu.lu@intel.com>
+ PR ld/19175
+ * ld-i386/i386.exp: Run pr19175.
+ * ld-x86-64/x86-64.exp: Likewise.
+ * ld-i386/pr19175.d: New file.
+ * ld-i386/pr19175.s: Likewise.
+ * ld-i386/pr19175.t: Likewise.
+ * ld-x86-64/pr19175.d: Likewise.
+ * ld-x86-64/pr19175.s: Likewise.
+ * ld-x86-64/pr19175.t: Likewise.
+
+2015-10-26 H.J. Lu <hongjiu.lu@intel.com>
+
PR ld/19171
* ld-i386/lea1.s: Add tests for address load of __start_XXX
and __stop_XXX.
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 9bf08da..84a63e8 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -315,6 +315,7 @@ run_dump_test "load4b"
run_dump_test "load5a"
run_dump_test "load5b"
run_dump_test "load6"
+run_dump_test "pr19175"
if { !([istarget "i?86-*-linux*"]
|| [istarget "i?86-*-gnu*"]
diff --git a/ld/testsuite/ld-i386/pr19175.d b/ld/testsuite/ld-i386/pr19175.d
new file mode 100644
index 0000000..3f2edb1
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19175.d
@@ -0,0 +1,13 @@
+#source: pr19175.s
+#as: --32
+#ld: -Bsymbolic -shared -melf_i386 -T pr19175.t
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+#...
+[ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%ecx\),%eax
+#pass
diff --git a/ld/testsuite/ld-i386/pr19175.s b/ld/testsuite/ld-i386/pr19175.s
new file mode 100644
index 0000000..dc846a9
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19175.s
@@ -0,0 +1,5 @@
+ .globl _start
+ .type _start, @function
+_start:
+ movl _text@GOT(%ecx), %eax
+ .size _start, .-_start
diff --git a/ld/testsuite/ld-i386/pr19175.t b/ld/testsuite/ld-i386/pr19175.t
new file mode 100644
index 0000000..1018e9e
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19175.t
@@ -0,0 +1,11 @@
+EXTERN(_start)
+ENTRY(_start)
+
+SECTIONS
+{
+ .text :
+ {
+ _text = .;
+ *(.text*)
+ }
+}
diff --git a/ld/testsuite/ld-x86-64/pr19175.d b/ld/testsuite/ld-x86-64/pr19175.d
new file mode 100644
index 0000000..70e5689
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19175.d
@@ -0,0 +1,13 @@
+#source: pr19175.s
+#as: --64
+#ld: -Bsymbolic -shared -melf_x86_64 -T pr19175.t
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+#...
+[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_start>
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19175.s b/ld/testsuite/ld-x86-64/pr19175.s
new file mode 100644
index 0000000..2548e07
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19175.s
@@ -0,0 +1,5 @@
+ .globl _start
+ .type _start, @function
+_start:
+ movq _text@GOTPCREL(%rip), %rax
+ .size _start, .-_start
diff --git a/ld/testsuite/ld-x86-64/pr19175.t b/ld/testsuite/ld-x86-64/pr19175.t
new file mode 100644
index 0000000..1018e9e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19175.t
@@ -0,0 +1,11 @@
+EXTERN(_start)
+ENTRY(_start)
+
+SECTIONS
+{
+ .text :
+ {
+ _text = .;
+ *(.text*)
+ }
+}
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 6caea5f..869cbe5 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -347,6 +347,7 @@ run_dump_test "pr18815"
run_dump_test "pr19013"
run_dump_test "pr19013-x32"
run_dump_test "pr19013-nacl"
+run_dump_test "pr19175"
# Add $PLT_CFLAGS if PLT is expected.
global PLT_CFLAGS