From 2856a6272397d159aa2a21fd2ef0f1a6e80f5e41 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 6 May 2016 05:28:18 -0700 Subject: [PATCH] Test load conversion with symbol versioning for x86 * testsuite/ld-i386/i386.exp: Run load7. * testsuite/ld-i386/load7.d: New file. * testsuite/ld-i386/load7.map: Likewise. * testsuite/ld-i386/load7.s: Likewise. * testsuite/ld-x86-64/load2.d: Likewise. * testsuite/ld-x86-64/load2.map: Likewise. * testsuite/ld-x86-64/load2.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run load2. --- ld/ChangeLog | 11 +++++++++++ ld/testsuite/ld-i386/i386.exp | 1 + ld/testsuite/ld-i386/load7.d | 15 +++++++++++++++ ld/testsuite/ld-i386/load7.map | 6 ++++++ ld/testsuite/ld-i386/load7.s | 18 ++++++++++++++++++ ld/testsuite/ld-x86-64/load2.d | 18 ++++++++++++++++++ ld/testsuite/ld-x86-64/load2.map | 6 ++++++ ld/testsuite/ld-x86-64/load2.s | 20 ++++++++++++++++++++ ld/testsuite/ld-x86-64/x86-64.exp | 1 + 9 files changed, 96 insertions(+) create mode 100644 ld/testsuite/ld-i386/load7.d create mode 100644 ld/testsuite/ld-i386/load7.map create mode 100644 ld/testsuite/ld-i386/load7.s create mode 100644 ld/testsuite/ld-x86-64/load2.d create mode 100644 ld/testsuite/ld-x86-64/load2.map create mode 100644 ld/testsuite/ld-x86-64/load2.s diff --git a/ld/ChangeLog b/ld/ChangeLog index 547563e8ea8..71712485769 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,14 @@ +2016-05-06 H.J. Lu + + * testsuite/ld-i386/i386.exp: Run load7. + * testsuite/ld-i386/load7.d: New file. + * testsuite/ld-i386/load7.map: Likewise. + * testsuite/ld-i386/load7.s: Likewise. + * testsuite/ld-x86-64/load2.d: Likewise. + * testsuite/ld-x86-64/load2.map: Likewise. + * testsuite/ld-x86-64/load2.s: Likewise. + * testsuite/ld-x86-64/x86-64.exp: Run load2. + 2016-05-05 H.J. Lu * emulparams/elf_iamcu.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): New. diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index c6708caea40..ba53c9107a5 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -326,6 +326,7 @@ run_dump_test "load4b" run_dump_test "load5a" run_dump_test "load5b" run_dump_test "load6" +run_dump_test "load7" run_dump_test "pr19175" run_dump_test "pr19615" run_dump_test "pr19636-1a" diff --git a/ld/testsuite/ld-i386/load7.d b/ld/testsuite/ld-i386/load7.d new file mode 100644 index 00000000000..898dc3900d1 --- /dev/null +++ b/ld/testsuite/ld-i386/load7.d @@ -0,0 +1,15 @@ +#as: --32 +#ld: -shared -melf_i386 --version-script load7.map +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%ecx\),%eax +#pass diff --git a/ld/testsuite/ld-i386/load7.map b/ld/testsuite/ld-i386/load7.map new file mode 100644 index 00000000000..a0a5e0f67b3 --- /dev/null +++ b/ld/testsuite/ld-i386/load7.map @@ -0,0 +1,6 @@ +{ +global: + _start; +local: + *; +}; diff --git a/ld/testsuite/ld-i386/load7.s b/ld/testsuite/ld-i386/load7.s new file mode 100644 index 00000000000..8849a38fb7a --- /dev/null +++ b/ld/testsuite/ld-i386/load7.s @@ -0,0 +1,18 @@ + .section my_section,"aw",@progbits + .long 0x12345678 + .text + .globl foo + .type foo, @function +foo: + ret + .size foo, .-foo + .globl _start + .type _start, @function +_start: + movl foo@GOT(%ecx), %eax + movl bar@GOT(%ecx), %eax + movl __start_my_section@GOT(%ecx), %eax + movl __stop_my_section@GOT(%ecx), %eax + .size _start, .-_start + .comm pad,4,4 + .comm bar,4,4 diff --git a/ld/testsuite/ld-x86-64/load2.d b/ld/testsuite/ld-x86-64/load2.d new file mode 100644 index 00000000000..f76ba9d55f2 --- /dev/null +++ b/ld/testsuite/ld-x86-64/load2.d @@ -0,0 +1,18 @@ +#as: --64 +#ld: -shared -melf_x86_64 --version-script load2.map +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[a-f0-9]+ <_start>: +[ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%eax # [a-f0-9]+ +[ ]*[a-f0-9]+: 44 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11d # [a-f0-9]+ +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ +[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__start_my_section> +[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <__stop_my_section> +#pass diff --git a/ld/testsuite/ld-x86-64/load2.map b/ld/testsuite/ld-x86-64/load2.map new file mode 100644 index 00000000000..a0a5e0f67b3 --- /dev/null +++ b/ld/testsuite/ld-x86-64/load2.map @@ -0,0 +1,6 @@ +{ +global: + _start; +local: + *; +}; diff --git a/ld/testsuite/ld-x86-64/load2.s b/ld/testsuite/ld-x86-64/load2.s new file mode 100644 index 00000000000..2c9982e16dc --- /dev/null +++ b/ld/testsuite/ld-x86-64/load2.s @@ -0,0 +1,20 @@ + .section my_section,"aw",@progbits + .long 0x12345678 + .text + .globl foo + .type foo, @function +foo: + ret + .size foo, .-foo + .globl _start + .type _start, @function +_start: + movl foo@GOTPCREL(%rip), %eax + movl bar@GOTPCREL(%rip), %r11d + movq foo@GOTPCREL(%rip), %rax + movq bar@GOTPCREL(%rip), %r11 + movq __start_my_section@GOTPCREL(%rip), %rax + movq __stop_my_section@GOTPCREL(%rip), %r11 + .size _start, .-_start + .comm pad,4,4 + .comm bar,4,4 diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index b48f3c7fc4d..d3990d076c0 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -363,6 +363,7 @@ run_dump_test "load1a-nacl" run_dump_test "load1b-nacl" run_dump_test "load1c-nacl" run_dump_test "load1d-nacl" +run_dump_test "load2" run_dump_test "call1a" run_dump_test "call1b" run_dump_test "call1c" -- 2.30.2