From dd1093aa2c82bcd88a4d16cb7fa7884733583f5e Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 24 Aug 2007 19:39:19 +0000 Subject: [PATCH] 2007-08-24 H.J. Lu * ld-i386/i386.exp (i386tests): Add a test for TLS IE->LE transition. Run tlsie2, tlsie3, tlsie4 and tlsie5. * ld-i386/tlsie1.dd: New file. * ld-i386/tlsie1.s: Likewise. * ld-i386/tlsie2.d: Likewise. * ld-i386/tlsie2.s: Likewise. * ld-i386/tlsie3.d: Likewise. * ld-i386/tlsie3.s: Likewise. * ld-i386/tlsie4.d: Likewise. * ld-i386/tlsie4.s: Likewise. * ld-i386/tlsie5.d: Likewise. * ld-i386/tlsie5.s: Likewise. * ld-x86-64/tlsgd2.d: Likewise. * ld-x86-64/tlsgd2.s: Likewise. * ld-x86-64/tlsgd3.d: Likewise. * ld-x86-64/tlsgd3.s: Likewise. * ld-x86-64/tlsie1.dd: Likewise. * ld-x86-64/tlsie1.s: Likewise. * ld-x86-64/tlsie2.d: Likewise. * ld-x86-64/tlsie2.s: Likewise. * ld-x86-64/tlsie3.d: Likewise. * ld-x86-64/tlsie3.s: Likewise. * ld-x86-64/x86-64.exp (x86_64tests): Add a test for TLS LD->LE transition. Run tlsgd2, tlsgd3, tlsie2 and tlsie3. --- ld/testsuite/ChangeLog | 31 +++++++++++++++++++++++++++++++ ld/testsuite/ld-i386/i386.exp | 7 +++++++ ld/testsuite/ld-i386/tlsie1.dd | 18 ++++++++++++++++++ ld/testsuite/ld-i386/tlsie1.s | 16 ++++++++++++++++ ld/testsuite/ld-i386/tlsie2.d | 4 ++++ ld/testsuite/ld-i386/tlsie2.s | 12 ++++++++++++ ld/testsuite/ld-i386/tlsie3.d | 4 ++++ ld/testsuite/ld-i386/tlsie3.s | 12 ++++++++++++ ld/testsuite/ld-i386/tlsie4.d | 4 ++++ ld/testsuite/ld-i386/tlsie4.s | 12 ++++++++++++ ld/testsuite/ld-i386/tlsie5.d | 4 ++++ ld/testsuite/ld-i386/tlsie5.s | 12 ++++++++++++ ld/testsuite/ld-x86-64/tlsgd2.d | 4 ++++ ld/testsuite/ld-x86-64/tlsgd2.s | 5 +++++ ld/testsuite/ld-x86-64/tlsgd3.d | 4 ++++ ld/testsuite/ld-x86-64/tlsgd3.s | 11 +++++++++++ ld/testsuite/ld-x86-64/tlsie1.dd | 16 ++++++++++++++++ ld/testsuite/ld-x86-64/tlsie1.s | 14 ++++++++++++++ ld/testsuite/ld-x86-64/tlsie2.d | 4 ++++ ld/testsuite/ld-x86-64/tlsie2.s | 12 ++++++++++++ ld/testsuite/ld-x86-64/tlsie3.d | 4 ++++ ld/testsuite/ld-x86-64/tlsie3.s | 12 ++++++++++++ ld/testsuite/ld-x86-64/x86-64.exp | 7 +++++++ 23 files changed, 229 insertions(+) create mode 100644 ld/testsuite/ld-i386/tlsie1.dd create mode 100644 ld/testsuite/ld-i386/tlsie1.s create mode 100644 ld/testsuite/ld-i386/tlsie2.d create mode 100644 ld/testsuite/ld-i386/tlsie2.s create mode 100644 ld/testsuite/ld-i386/tlsie3.d create mode 100644 ld/testsuite/ld-i386/tlsie3.s create mode 100644 ld/testsuite/ld-i386/tlsie4.d create mode 100644 ld/testsuite/ld-i386/tlsie4.s create mode 100644 ld/testsuite/ld-i386/tlsie5.d create mode 100644 ld/testsuite/ld-i386/tlsie5.s create mode 100644 ld/testsuite/ld-x86-64/tlsgd2.d create mode 100644 ld/testsuite/ld-x86-64/tlsgd2.s create mode 100644 ld/testsuite/ld-x86-64/tlsgd3.d create mode 100644 ld/testsuite/ld-x86-64/tlsgd3.s create mode 100644 ld/testsuite/ld-x86-64/tlsie1.dd create mode 100644 ld/testsuite/ld-x86-64/tlsie1.s create mode 100644 ld/testsuite/ld-x86-64/tlsie2.d create mode 100644 ld/testsuite/ld-x86-64/tlsie2.s create mode 100644 ld/testsuite/ld-x86-64/tlsie3.d create mode 100644 ld/testsuite/ld-x86-64/tlsie3.s diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index ad425418a52..ecd896ca624 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,34 @@ +2007-08-24 H.J. Lu + + * ld-i386/i386.exp (i386tests): Add a test for TLS IE->LE + transition. + Run tlsie2, tlsie3, tlsie4 and tlsie5. + + * ld-i386/tlsie1.dd: New file. + * ld-i386/tlsie1.s: Likewise. + * ld-i386/tlsie2.d: Likewise. + * ld-i386/tlsie2.s: Likewise. + * ld-i386/tlsie3.d: Likewise. + * ld-i386/tlsie3.s: Likewise. + * ld-i386/tlsie4.d: Likewise. + * ld-i386/tlsie4.s: Likewise. + * ld-i386/tlsie5.d: Likewise. + * ld-i386/tlsie5.s: Likewise. + * ld-x86-64/tlsgd2.d: Likewise. + * ld-x86-64/tlsgd2.s: Likewise. + * ld-x86-64/tlsgd3.d: Likewise. + * ld-x86-64/tlsgd3.s: Likewise. + * ld-x86-64/tlsie1.dd: Likewise. + * ld-x86-64/tlsie1.s: Likewise. + * ld-x86-64/tlsie2.d: Likewise. + * ld-x86-64/tlsie2.s: Likewise. + * ld-x86-64/tlsie3.d: Likewise. + * ld-x86-64/tlsie3.s: Likewise. + + * ld-x86-64/x86-64.exp (x86_64tests): Add a test for TLS LD->LE + transition. + Run tlsgd2, tlsgd3, tlsie2 and tlsie3. + 2007-08-23 H.J. Lu * ld-i386/tlsbinpic.s: Add a new GD -> IE test. diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 2c7c14b317e..10f90ce6279 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -115,6 +115,9 @@ set i386tests { {"TLS LD->LE transition" "-melf_i386" "--32" {tlsld1.s} {{objdump -dwr tlsld1.dd}} "tlsld1"} + {"TLS IE->LE transition" "-melf_i386" + "--32" {tlsie1.s} + {{objdump -dwr tlsie1.dd}} "tlsie1"} } run_ld_link_tests $i386tests @@ -125,3 +128,7 @@ run_dump_test "pcrel16" run_dump_test "pcrel16abs" run_dump_test "alloc" run_dump_test "warn1" +run_dump_test "tlsie2" +run_dump_test "tlsie3" +run_dump_test "tlsie4" +run_dump_test "tlsie5" diff --git a/ld/testsuite/ld-i386/tlsie1.dd b/ld/testsuite/ld-i386/tlsie1.dd new file mode 100644 index 00000000000..2cebc70474e --- /dev/null +++ b/ld/testsuite/ld-i386/tlsie1.dd @@ -0,0 +1,18 @@ +#source: tlsie1.s +#as: --32 +#ld: -melf_i386 tmpdir/tlsld1 +#objdump: -drw +#target: i?86-*-linux* + +.*: +file format .* + +Disassembly of section .text: + +[a-f0-9]+ <_start>: +[ ]*[a-f0-9]+: 81 c1 fc ff ff ff add \$0xfffffffc,%ecx +[ ]*[a-f0-9]+: 81 c1 fc ff ff ff add \$0xfffffffc,%ecx +[ ]*[a-f0-9]+: c7 c0 fc ff ff ff mov \$0xfffffffc,%eax +[ ]*[a-f0-9]+: c7 c1 fc ff ff ff mov \$0xfffffffc,%ecx +[ ]*[a-f0-9]+: b8 fc ff ff ff mov \$0xfffffffc,%eax +[ ]*[a-f0-9]+: c7 c1 fc ff ff ff mov \$0xfffffffc,%ecx +#pass diff --git a/ld/testsuite/ld-i386/tlsie1.s b/ld/testsuite/ld-i386/tlsie1.s new file mode 100644 index 00000000000..d4ad569912f --- /dev/null +++ b/ld/testsuite/ld-i386/tlsie1.s @@ -0,0 +1,16 @@ + .text + .globl _start +_start: + addl foo@gotntpoff(%ebx), %ecx + addl foo@indntpoff, %ecx + movl foo@gotntpoff(%ebx), %eax + movl foo@gotntpoff(%ebx), %ecx + movl foo@indntpoff, %eax + movl foo@indntpoff, %ecx + .globl foo + .section .tdata,"awT",@progbits + .align 4 + .type foo, @object + .size foo, 4 +foo: + .long 100 diff --git a/ld/testsuite/ld-i386/tlsie2.d b/ld/testsuite/ld-i386/tlsie2.d new file mode 100644 index 00000000000..ebb85fde7e7 --- /dev/null +++ b/ld/testsuite/ld-i386/tlsie2.d @@ -0,0 +1,4 @@ +#name: TLS IE->LE transition check (R_386_TLS_GOTIE with %eax) +#as: --32 +#ld: -melf_i386 +#error: .*TLS transition from R_386_TLS_GOTIE to R_386_TLS_LE_32 against `foo'.*failed.* diff --git a/ld/testsuite/ld-i386/tlsie2.s b/ld/testsuite/ld-i386/tlsie2.s new file mode 100644 index 00000000000..72df61744ff --- /dev/null +++ b/ld/testsuite/ld-i386/tlsie2.s @@ -0,0 +1,12 @@ + .text + .globl _start +_start: + leal foo@gotntpoff(%ebx), %eax + movl (%eax), %eax + .globl foo + .section .tdata,"awT",@progbits + .align 4 + .type foo, @object + .size foo, 4 +foo: + .long 100 diff --git a/ld/testsuite/ld-i386/tlsie3.d b/ld/testsuite/ld-i386/tlsie3.d new file mode 100644 index 00000000000..d993f303c25 --- /dev/null +++ b/ld/testsuite/ld-i386/tlsie3.d @@ -0,0 +1,4 @@ +#name: TLS IE->LE transition check (R_386_TLS_GOTIE) +#as: --32 +#ld: -melf_i386 +#error: .*TLS transition from R_386_TLS_GOTIE to R_386_TLS_LE_32 against `foo'.*failed.* diff --git a/ld/testsuite/ld-i386/tlsie3.s b/ld/testsuite/ld-i386/tlsie3.s new file mode 100644 index 00000000000..865156db992 --- /dev/null +++ b/ld/testsuite/ld-i386/tlsie3.s @@ -0,0 +1,12 @@ + .text + .globl _start +_start: + leal foo@gotntpoff(%ebx), %ecx + movl (%ecx), %ecx + .globl foo + .section .tdata,"awT",@progbits + .align 4 + .type foo, @object + .size foo, 4 +foo: + .long 100 diff --git a/ld/testsuite/ld-i386/tlsie4.d b/ld/testsuite/ld-i386/tlsie4.d new file mode 100644 index 00000000000..3ca8fddf5dd --- /dev/null +++ b/ld/testsuite/ld-i386/tlsie4.d @@ -0,0 +1,4 @@ +#name: TLS IE->LE transition check (R_386_TLS_IE with %eax) +#as: --32 +#ld: -melf_i386 +#error: .*TLS transition from R_386_TLS_IE to R_386_TLS_LE_32 against `foo'.*failed.* diff --git a/ld/testsuite/ld-i386/tlsie4.s b/ld/testsuite/ld-i386/tlsie4.s new file mode 100644 index 00000000000..3469f29cc1a --- /dev/null +++ b/ld/testsuite/ld-i386/tlsie4.s @@ -0,0 +1,12 @@ + .text + .globl _start +_start: + leal foo@indntpoff(%ebx), %eax + movl (%eax), %eax + .globl foo + .section .tdata,"awT",@progbits + .align 4 + .type foo, @object + .size foo, 4 +foo: + .long 100 diff --git a/ld/testsuite/ld-i386/tlsie5.d b/ld/testsuite/ld-i386/tlsie5.d new file mode 100644 index 00000000000..3febeb159a9 --- /dev/null +++ b/ld/testsuite/ld-i386/tlsie5.d @@ -0,0 +1,4 @@ +#name: TLS IE->LE transition check (R_386_TLS_IE) +#as: --32 +#ld: -melf_i386 +#error: .*TLS transition from R_386_TLS_IE to R_386_TLS_LE_32 against `foo'.*failed.* diff --git a/ld/testsuite/ld-i386/tlsie5.s b/ld/testsuite/ld-i386/tlsie5.s new file mode 100644 index 00000000000..affee3186f9 --- /dev/null +++ b/ld/testsuite/ld-i386/tlsie5.s @@ -0,0 +1,12 @@ + .text + .globl _start +_start: + leal foo@indntpoff, %ecx + movl (%ecx), %ecx + .globl foo + .section .tdata,"awT",@progbits + .align 4 + .type foo, @object + .size foo, 4 +foo: + .long 100 diff --git a/ld/testsuite/ld-x86-64/tlsgd2.d b/ld/testsuite/ld-x86-64/tlsgd2.d new file mode 100644 index 00000000000..494560b500b --- /dev/null +++ b/ld/testsuite/ld-x86-64/tlsgd2.d @@ -0,0 +1,4 @@ +#name: TLS GD->IE transition check +#as: --64 +#ld: -melf_x86_64 +#error: .*TLS transition from R_X86_64_TLSGD to R_X86_64_GOTTPOFF against `foo'.*failed.* diff --git a/ld/testsuite/ld-x86-64/tlsgd2.s b/ld/testsuite/ld-x86-64/tlsgd2.s new file mode 100644 index 00000000000..f583c853411 --- /dev/null +++ b/ld/testsuite/ld-x86-64/tlsgd2.s @@ -0,0 +1,5 @@ + .text + .globl _start +_start: + leaq foo@TLSGD(%rip), %rdi + call __tls_get_addr diff --git a/ld/testsuite/ld-x86-64/tlsgd3.d b/ld/testsuite/ld-x86-64/tlsgd3.d new file mode 100644 index 00000000000..40f8e3d2277 --- /dev/null +++ b/ld/testsuite/ld-x86-64/tlsgd3.d @@ -0,0 +1,4 @@ +#name: TLS GD->LE transition check +#as: --64 +#ld: -melf_x86_64 +#error: .*TLS transition from R_X86_64_TLSGD to R_X86_64_TPOFF32 against `a local symbol'.*failed.* diff --git a/ld/testsuite/ld-x86-64/tlsgd3.s b/ld/testsuite/ld-x86-64/tlsgd3.s new file mode 100644 index 00000000000..e1e7e601f49 --- /dev/null +++ b/ld/testsuite/ld-x86-64/tlsgd3.s @@ -0,0 +1,11 @@ + .text + .globl _start +_start: + leaq foo@TLSGD(%rip), %rdi + call __tls_get_addr + .section .tdata,"awT",@progbits + .align 4 + .type foo, @object + .size foo, 4 +foo: + .long 100 diff --git a/ld/testsuite/ld-x86-64/tlsie1.dd b/ld/testsuite/ld-x86-64/tlsie1.dd new file mode 100644 index 00000000000..74dc39b766e --- /dev/null +++ b/ld/testsuite/ld-x86-64/tlsie1.dd @@ -0,0 +1,16 @@ +#source: tlsie1.s +#as: --64 +#ld: -melf_x86_64 tmpdir/tlsie1 +#objdump: -drw +#target: x86_64-*-linux* + +.*: +file format .* + +Disassembly of section .text: + +[a-f0-9]+ <_start>: +[ ]*[a-f0-9]+: 48 c7 c0 fc ff ff ff mov \$0xfffffffffffffffc,%rax +[ ]*[a-f0-9]+: 48 8d 80 fc ff ff ff lea -0x4\(%rax\),%rax +[ ]*[a-f0-9]+: 49 c7 c4 fc ff ff ff mov \$0xfffffffffffffffc,%r12 +[ ]*[a-f0-9]+: 49 81 c4 fc ff ff ff add \$0xfffffffffffffffc,%r12 +#pass diff --git a/ld/testsuite/ld-x86-64/tlsie1.s b/ld/testsuite/ld-x86-64/tlsie1.s new file mode 100644 index 00000000000..c7722b1d585 --- /dev/null +++ b/ld/testsuite/ld-x86-64/tlsie1.s @@ -0,0 +1,14 @@ + .text + .globl _start +_start: + movq foo@GOTTPOFF(%rip), %rax + addq foo@GOTTPOFF(%rip), %rax + movq foo@GOTTPOFF(%rip), %r12 + addq foo@GOTTPOFF(%rip), %r12 + .globl foo + .section .tdata,"awT",@progbits + .align 4 + .type foo, @object + .size foo, 4 +foo: + .long 100 diff --git a/ld/testsuite/ld-x86-64/tlsie2.d b/ld/testsuite/ld-x86-64/tlsie2.d new file mode 100644 index 00000000000..97dcc288a3d --- /dev/null +++ b/ld/testsuite/ld-x86-64/tlsie2.d @@ -0,0 +1,4 @@ +#name: TLS IE->LE transition check +#as: --64 +#ld: -melf_x86_64 +#error: .*TLS transition from R_X86_64_GOTTPOFF to R_X86_64_TPOFF32 against `foo'.*failed.* diff --git a/ld/testsuite/ld-x86-64/tlsie2.s b/ld/testsuite/ld-x86-64/tlsie2.s new file mode 100644 index 00000000000..c9b9bfb26db --- /dev/null +++ b/ld/testsuite/ld-x86-64/tlsie2.s @@ -0,0 +1,12 @@ + .text + .globl _start +_start: + leaq foo@GOTTPOFF(%rip), %rax + movq (%rax), %rax + .globl foo + .section .tdata,"awT",@progbits + .align 4 + .type foo, @object + .size foo, 4 +foo: + .long 100 diff --git a/ld/testsuite/ld-x86-64/tlsie3.d b/ld/testsuite/ld-x86-64/tlsie3.d new file mode 100644 index 00000000000..8c982a69838 --- /dev/null +++ b/ld/testsuite/ld-x86-64/tlsie3.d @@ -0,0 +1,4 @@ +#name: TLS IE->LE transition check (%r12) +#as: --64 +#ld: -melf_x86_64 +#error: .*TLS transition from R_X86_64_GOTTPOFF to R_X86_64_TPOFF32 against `foo'.*failed.* diff --git a/ld/testsuite/ld-x86-64/tlsie3.s b/ld/testsuite/ld-x86-64/tlsie3.s new file mode 100644 index 00000000000..13faf344361 --- /dev/null +++ b/ld/testsuite/ld-x86-64/tlsie3.s @@ -0,0 +1,12 @@ + .text + .globl _start +_start: + leaq foo@GOTTPOFF(%rip), %r12 + movq (%r12), %r12 + .globl foo + .section .tdata,"awT",@progbits + .align 4 + .type foo, @object + .size foo, 4 +foo: + .long 100 diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 3d251292a76..cd2609108aa 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -72,6 +72,9 @@ set x86_64tests { {"TLS LD->LE transition" "-melf_x86_64" "--64" {tlsld1.s} {{objdump -dwr tlsld1.dd}} "tlsld1"} + {"TLS IE->LE transition" "-melf_x86_64" + "--64" {tlsie1.s} + {{objdump -dwr tlsie1.dd}} "tlsie1"} } run_ld_link_tests $x86_64tests @@ -79,3 +82,7 @@ run_ld_link_tests $x86_64tests run_dump_test "abs" run_dump_test "pcrel8" run_dump_test "pcrel16" +run_dump_test "tlsgd2" +run_dump_test "tlsgd3" +run_dump_test "tlsie2" +run_dump_test "tlsie3" -- 2.30.2