diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2018-05-18 06:43:19 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-05-18 06:43:34 -0700 |
commit | 011b32fd4270fb7111ee1f63695ccd44562ee7df (patch) | |
tree | 110abd5acda6059b6296fa3ba26bfa65543ce9de /ld | |
parent | 4bba0fb1c6d391a217c25e44398a7e1c7090155f (diff) | |
download | gdb-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')
-rw-r--r-- | ld/ChangeLog | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/i386.exp | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/pr23189.d | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/pr23189.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/pr23189.t | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr23189.d | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr23189.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr23189.t | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/x86-64.exp | 1 |
9 files changed, 60 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 78c0d26..5986f3c 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,15 @@ +2018-05-18 H.J. Lu <hongjiu.lu@intel.com> + + 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. + 2018-05-15 Alan Modra <amodra@gmail.com> * testsuite/ld-elf/notes.exp: Restore LDFLAGS. 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*) + } +} diff --git a/ld/testsuite/ld-x86-64/pr23189.d b/ld/testsuite/ld-x86-64/pr23189.d new file mode 100644 index 0000000..7951c7a --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr23189.d @@ -0,0 +1,7 @@ +#as: --64 -mrelax-relocations=yes +#ld: -shared -melf_x86_64 -T pr23189.t +#readelf: -r --wide + +Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry: + Offset Info Type Symbol's Value Symbol's Name \+ Addend +[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+ diff --git a/ld/testsuite/ld-x86-64/pr23189.s b/ld/testsuite/ld-x86-64/pr23189.s new file mode 100644 index 0000000..971ad8f --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr23189.s @@ -0,0 +1,5 @@ + .globl _start + .type _start, @function +_start: + movq __hidden_sym@GOTPCREL(%rip), %rax + .size _start, .-_start diff --git a/ld/testsuite/ld-x86-64/pr23189.t b/ld/testsuite/ld-x86-64/pr23189.t new file mode 100644 index 0000000..0e6ff65 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr23189.t @@ -0,0 +1,11 @@ +EXTERN(_start) +ENTRY(_start) + +SECTIONS +{ + .text : + { + HIDDEN (__hidden_sym = .); + *(.text*) + } +} diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 5a06947..563e782 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -606,6 +606,7 @@ run_dump_test "pr20253-5b" run_dump_test "tlsdesc2" run_dump_test "pr22048" run_dump_test "pr22929" +run_dump_test "pr23189" proc undefined_weak {cflags ldflags} { set testname "Undefined weak symbol" |