aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-i386
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-05-18 06:43:19 -0700
committerH.J. Lu <hjl.tools@gmail.com>2018-05-18 06:43:34 -0700
commit011b32fd4270fb7111ee1f63695ccd44562ee7df (patch)
tree110abd5acda6059b6296fa3ba26bfa65543ce9de /ld/testsuite/ld-i386
parent4bba0fb1c6d391a217c25e44398a7e1c7090155f (diff)
downloadgdb-011b32fd4270fb7111ee1f63695ccd44562ee7df.zip
gdb-011b32fd4270fb7111ee1f63695ccd44562ee7df.tar.gz
gdb-011b32fd4270fb7111ee1f63695ccd44562ee7df.tar.bz2
x86: Don't set eh->local_ref to 1 for linker defined symbols
Since symbols created by HIDDEN and PROVIDE_HIDDEN assignments in linker script may be marked as defined, but not hidden, we can't set eh->local_ref to 1 in _bfd_x86_elf_link_symbol_references_local. Also R_386_GOT32X should be handled as just like R_386_GOT32 when relocating a section. The input R_386_GOT32X relocations, which can be relaxed, should have been converted to R_386_PC32, R_386_32 or R_386_GOTOFF. bfd/ PR ld/23189 * elf32-i386.c (elf_i386_relocate_section): Handle R_386_GOT32X like R_386_GOT32. * elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't set eh->local_ref to 1 for linker defined symbols. ld/ PR ld/23189 * testsuite/ld-i386/i386.exp: Run pr23189. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr23189.d: New file. * testsuite/ld-i386/pr23189.s: Likewise. * testsuite/ld-i386/pr23189.t: Likewise. * testsuite/ld-x86-64/pr23189.d: Likewise. * testsuite/ld-x86-64/pr23189.s: Likewise. * testsuite/ld-x86-64/pr23189.t: Likewise.
Diffstat (limited to 'ld/testsuite/ld-i386')
-rw-r--r--ld/testsuite/ld-i386/i386.exp1
-rw-r--r--ld/testsuite/ld-i386/pr23189.d7
-rw-r--r--ld/testsuite/ld-i386/pr23189.s5
-rw-r--r--ld/testsuite/ld-i386/pr23189.t11
4 files changed, 24 insertions, 0 deletions
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 0d50b63..7aec534 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -479,6 +479,7 @@ run_dump_test "pr18815"
run_dump_test "pr19939a"
run_dump_test "pr19939b"
run_dump_test "tlsdesc2"
+run_dump_test "pr23189"
proc undefined_weak {cflags ldflags} {
set testname "Undefined weak symbol"
diff --git a/ld/testsuite/ld-i386/pr23189.d b/ld/testsuite/ld-i386/pr23189.d
new file mode 100644
index 0000000..9345b42
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr23189.d
@@ -0,0 +1,7 @@
+#as: --32 -mrelax-relocations=yes
+#ld: -shared -melf_i386 -T pr23189.t
+#readelf: -r --wide
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
+ Offset Info Type Sym. Value Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
diff --git a/ld/testsuite/ld-i386/pr23189.s b/ld/testsuite/ld-i386/pr23189.s
new file mode 100644
index 0000000..4a6c9cd
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr23189.s
@@ -0,0 +1,5 @@
+ .globl _start
+ .type _start, @function
+_start:
+ movl __hidden_sym@GOT(%eax), %eax
+ .size _start, .-_start
diff --git a/ld/testsuite/ld-i386/pr23189.t b/ld/testsuite/ld-i386/pr23189.t
new file mode 100644
index 0000000..0e6ff65
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr23189.t
@@ -0,0 +1,11 @@
+EXTERN(_start)
+ENTRY(_start)
+
+SECTIONS
+{
+ .text :
+ {
+ HIDDEN (__hidden_sym = .);
+ *(.text*)
+ }
+}