From 87d455c042d2236b2afb1d6e13f337df36256bb0 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 19 Apr 2016 20:11:55 -0700 Subject: [PATCH] Add another testcase for PR ld/19719 This test checks run-time relocation overflow with GOT relocation and 32-bit relocation against the same symbol. PR ld/19719 * testsuite/ld-x86-64/pr19719.d: New file. * testsuite/ld-x86-64/pr19719.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run pr19719. --- ld/ChangeLog | 7 +++++++ ld/testsuite/ld-x86-64/pr19719.d | 3 +++ ld/testsuite/ld-x86-64/pr19719.s | 16 ++++++++++++++++ ld/testsuite/ld-x86-64/x86-64.exp | 1 + 4 files changed, 27 insertions(+) create mode 100644 ld/testsuite/ld-x86-64/pr19719.d create mode 100644 ld/testsuite/ld-x86-64/pr19719.s diff --git a/ld/ChangeLog b/ld/ChangeLog index 0701b12858..e206ea30a5 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2016-04-19 H.J. Lu + + PR ld/19719 + * testsuite/ld-x86-64/pr19719.d: New file. + * testsuite/ld-x86-64/pr19719.s: Likewise. + * testsuite/ld-x86-64/x86-64.exp: Run pr19719. + 2016-04-18 Matthew Fortune * ld.texinfo: Document NOCROSSREFS_TO script command. diff --git a/ld/testsuite/ld-x86-64/pr19719.d b/ld/testsuite/ld-x86-64/pr19719.d new file mode 100644 index 0000000000..b2daf0e3c9 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr19719.d @@ -0,0 +1,3 @@ +#as: --64 +#ld: -pie -melf_x86_64 +#error: .*relocation R_X86_64_32 against undefined symbol `foo' can not be used when making a shared object; recompile with -fPIC diff --git a/ld/testsuite/ld-x86-64/pr19719.s b/ld/testsuite/ld-x86-64/pr19719.s new file mode 100644 index 0000000000..f446782b9d --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr19719.s @@ -0,0 +1,16 @@ + .text + .globl _start + .type _start, @function +_start: + movl foo_p(%rip), %eax + movq foo@GOTPCREL(%rip), %rax + ret + .size _start, .-_start + .globl foo_p + .data + .align 4 + .type foo_p, @object + .weak foo + .size foo_p, 4 +foo_p: + .long foo diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 3cec4dd065..2dba81d659 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -440,6 +440,7 @@ run_dump_test "pr19609-7c" run_dump_test "pr19609-7d" run_dump_test "pr19939a" run_dump_test "pr19939b" +run_dump_test "pr19719" proc undefined_weak {cflags ldflags} { set testname "Undefined weak symbol"