From 81e8046dc0daaf56fb10b11931fc77600a4b5920 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 16 Aug 2019 14:25:15 -0700 Subject: x86-64: Move PIC check for PC-relative relocations back commit 83924b3846361f2f76f9a6e7b5afa01c0eebbd4f Author: H.J. Lu Date: Tue Feb 5 18:45:23 2019 -0800 x86-64: Restore PIC check for PCREL reloc against protected symbol moved PIC check for PC-relative relocations to elf_x86_64_check_relocs. Since linker defined symbols may not be processed at the time, we need to move the check back to elf_x86_64_relocate_section. bfd/ PR ld/24905 * elf64-x86-64.c (elf_x86_64_check_relocs): Move PIC check for PC-relative relocations back to ... (elf_x86_64_relocate_section): Here. ld/ PR ld/24905 * testsuite/ld-x86-64/pr24905-x32.d: New file. * testsuite/ld-x86-64/pr24905.d: Likewise. * testsuite/ld-x86-64/pr24905.s: Likewise. * testsuite/ld-x86-64/pr24905.t: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run pr24905 and pr24905-x32. --- ld/ChangeLog | 9 +++++++++ ld/testsuite/ld-x86-64/pr24905-x32.d | 8 ++++++++ ld/testsuite/ld-x86-64/pr24905.d | 7 +++++++ ld/testsuite/ld-x86-64/pr24905.s | 6 ++++++ ld/testsuite/ld-x86-64/pr24905.t | 1 + ld/testsuite/ld-x86-64/x86-64.exp | 2 ++ 6 files changed, 33 insertions(+) create mode 100644 ld/testsuite/ld-x86-64/pr24905-x32.d create mode 100644 ld/testsuite/ld-x86-64/pr24905.d create mode 100644 ld/testsuite/ld-x86-64/pr24905.s create mode 100644 ld/testsuite/ld-x86-64/pr24905.t (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 34d3240..4837aac 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,12 @@ +2019-08-16 H.J. Lu + + PR ld/24905 + * testsuite/ld-x86-64/pr24905-x32.d: New file. + * testsuite/ld-x86-64/pr24905.d: Likewise. + * testsuite/ld-x86-64/pr24905.s: Likewise. + * testsuite/ld-x86-64/pr24905.t: Likewise. + * testsuite/ld-x86-64/x86-64.exp: Run pr24905 and pr24905-x32. + 2019-08-16 Christophe Lyon * emulparams/armelf.sh (OTHER_SECTIONS): Add support for noinit diff --git a/ld/testsuite/ld-x86-64/pr24905-x32.d b/ld/testsuite/ld-x86-64/pr24905-x32.d new file mode 100644 index 0000000..e2c6a73 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr24905-x32.d @@ -0,0 +1,8 @@ +#source: pr24905.s +#as: --x32 +#ld: -shared -melf32_x86_64 $srcdir/$subdir/pr24905.t +#nm: -n + +#... +[0-9a-f]* t EXTERNAL_SYM +#pass diff --git a/ld/testsuite/ld-x86-64/pr24905.d b/ld/testsuite/ld-x86-64/pr24905.d new file mode 100644 index 0000000..f11834f --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr24905.d @@ -0,0 +1,7 @@ +#as: --64 +#ld: -shared -melf_x86_64 $srcdir/$subdir/pr24905.t +#nm: -n + +#... +[0-9a-f]* t EXTERNAL_SYM +#pass diff --git a/ld/testsuite/ld-x86-64/pr24905.s b/ld/testsuite/ld-x86-64/pr24905.s new file mode 100644 index 0000000..73a5d58 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr24905.s @@ -0,0 +1,6 @@ + .text + .globl foo + .type foo, @function +foo: + leaq EXTERNAL_SYM(%rip), %rdi + .hidden EXTERNAL_SYM diff --git a/ld/testsuite/ld-x86-64/pr24905.t b/ld/testsuite/ld-x86-64/pr24905.t new file mode 100644 index 0000000..5e7dbd3 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr24905.t @@ -0,0 +1 @@ +PROVIDE_HIDDEN(EXTERNAL_SYM = ADDR(.text)); diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index d815e5d..b13cc7d 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -458,6 +458,8 @@ run_dump_test "pr24458c" run_dump_test "pr24458c-x32" run_dump_test "pr24721" run_dump_test "pr24721-x32" +run_dump_test "pr24905" +run_dump_test "pr24905-x32" if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} { return -- cgit v1.1