From bdb892b99584bfd481ed23c90ad7ceafb31ca791 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 20 Mar 2012 18:16:38 +0000 Subject: Handle relocation against protected function for -Bsymbolic bfd/ 2012-03-20 H.J. Lu PR ld/13880 * elf32-i386.c (elf_i386_relocate_section): Don't issue an error for R_386_GOTOFF relocation against protected function if SYMBOLIC_BIND is true. * elf64-x86-64.c (elf_x86_64_relocate_section): Don't issue an error for R_X86_64_GOTOFF64 relocation against protected function when building executable or SYMBOLIC_BIND is true. ld/testsuite/ 2012-03-20 H.J. Lu PR ld/13880 * ld-i386/i386.exp: Run protected4 and protected5. * ld-x86-64/x86-64.exp: Likewise. * ld-i386/protected4.d: New. * ld-i386/protected4.s: Likewise. * ld-i386/protected5.d: Likewise. * ld-i386/protected5.s: Likewise. * ld-x86-64/protected4.d: Likewise. * ld-x86-64/protected4.s: Likewise. * ld-x86-64/protected5.d: Likewise. * ld-x86-64/protected5.s: Likewise. --- ld/testsuite/ld-i386/i386.exp | 2 ++ ld/testsuite/ld-i386/protected4.d | 5 +++++ ld/testsuite/ld-i386/protected4.s | 12 ++++++++++++ ld/testsuite/ld-i386/protected5.d | 5 +++++ ld/testsuite/ld-i386/protected5.s | 12 ++++++++++++ 5 files changed, 36 insertions(+) create mode 100644 ld/testsuite/ld-i386/protected4.d create mode 100644 ld/testsuite/ld-i386/protected4.s create mode 100644 ld/testsuite/ld-i386/protected5.d create mode 100644 ld/testsuite/ld-i386/protected5.s (limited to 'ld/testsuite/ld-i386') diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 1727922..ff9db98 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -194,6 +194,8 @@ run_dump_test "hidden3" run_dump_test "protected1" run_dump_test "protected2" run_dump_test "protected3" +run_dump_test "protected4" +run_dump_test "protected5" run_dump_test "tlspie1" run_dump_test "tlspie2" run_dump_test "nogot1" diff --git a/ld/testsuite/ld-i386/protected4.d b/ld/testsuite/ld-i386/protected4.d new file mode 100644 index 0000000..f16f0c0 --- /dev/null +++ b/ld/testsuite/ld-i386/protected4.d @@ -0,0 +1,5 @@ +#as: --32 +#ld: -shared -Bsymbolic -melf_i386 +#readelf: -r + +There are no relocations in this file. diff --git a/ld/testsuite/ld-i386/protected4.s b/ld/testsuite/ld-i386/protected4.s new file mode 100644 index 0000000..66f2a56 --- /dev/null +++ b/ld/testsuite/ld-i386/protected4.s @@ -0,0 +1,12 @@ + .text + .protected foo + .globl foo + .type foo, @function +foo: + ret + .size foo, .-foo + .globl bar + .type bar, @function +bar: + movl foo@GOTOFF(%ecx), %eax + .size bar, .-bar diff --git a/ld/testsuite/ld-i386/protected5.d b/ld/testsuite/ld-i386/protected5.d new file mode 100644 index 0000000..89e2159 --- /dev/null +++ b/ld/testsuite/ld-i386/protected5.d @@ -0,0 +1,5 @@ +#as: --32 +#ld: -pie -melf_i386 +#readelf: -r + +There are no relocations in this file. diff --git a/ld/testsuite/ld-i386/protected5.s b/ld/testsuite/ld-i386/protected5.s new file mode 100644 index 0000000..fc218f2 --- /dev/null +++ b/ld/testsuite/ld-i386/protected5.s @@ -0,0 +1,12 @@ + .text + .protected foo + .globl foo + .type foo, @function +foo: + ret + .size foo, .-foo + .globl _start + .type _start, @function +_start: + movl foo@GOTOFF(%ecx), %eax + .size _start, .-_start -- cgit v1.1