diff options
Diffstat (limited to 'ld/testsuite')
37 files changed, 2157 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 0eb5106..0910af2 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,45 @@ +2011-01-10 Nathan Sidwell <nathan@codesourcery.com> + Glauber de Oliveira Costa <glommer@gmail.com> + + * ld-arm/arm-elf.exp: Added tests for new TLS handling + relocations. + * ld-arm/tls-descrelax-be32.d: New. + * ld-arm/tls-descrelax-be32.s: New. + * ld-arm/tls-descrelax-be8.d: New. + * ld-arm/tls-descrelax-be8.s: New. + * ld-arm/tls-descrelax-v7.d: New. + * ld-arm/tls-descrelax-v7.s: New. + * ld-arm/tls-descrelax.d: New. + * ld-arm/tls-descrelax.s: New. + * ld-arm/tls-descseq.d: New. + * ld-arm/tls-descseq.r: New. + * ld-arm/tls-descseq.s: New. + * ld-arm/tls-gdesc-got.d: New. + * ld-arm/tls-gdesc-got.s: New. + * ld-arm/tls-gdesc-nlazy.g: New. + * ld-arm/tls-gdesc-nlazy.s: New. + * ld-arm/tls-gdesc.d: New. + * ld-arm/tls-gdesc.r: New. + * ld-arm/tls-gdesc.s: New. + * ld-arm/tls-gdierelax.d: New. + * ld-arm/tls-gdierelax.s: New. + * ld-arm/tls-gdierelax2.d: New. + * ld-arm/tls-gdierelax2.s: New. + * ld-arm/tls-gdlerelax.d: New. + * ld-arm/tls-gdlerelax.s: New. + * ld-arm/tls-lib-loc.d: New. + * ld-arm/tls-lib-loc.r: New. + * ld-arm/tls-lib-loc.s: New. + * ld-arm/tls-longplt-lib.d: New. + * ld-arm/tls-longplt-lib.s: New. + * ld-arm/tls-longplt.d: New. + * ld-arm/tls-longplt.s: New. + * ld-arm/tls-mixed.r: New. + * ld-arm/tls-mixed.s: New. + * ld-arm/tls-thumb1.d: New. + * ld-arm/tls-thumb1.s: New. + * ld-arm/arm-elf.exp: New. + 2011-01-08 Nick Clifton <nickc@redhat.com> * ld-misc/defsym1.d: Add a -e linker command line option. diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index 80f521e..9ba7b56 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -135,6 +135,39 @@ set armelftests { {"TLS dynamic application" "-T arm-dyn.ld tmpdir/tls-lib.so" "" {tls-app.s} {{objdump -fdw tls-app.d} {objdump -Rw tls-app.r}} "tls-app"} + {"TLS gnu shared library got" "-shared -T arm-dyn.ld" "" {tls-gdesc-got.s} + {{objdump "-fDR -j .got" tls-gdesc-got.d}} + "tls-lib2-got.so"} + {"TLS gnu shared library inlined trampoline" "-shared -T arm-dyn.ld" "" {tls-descseq.s} + {{objdump -fdw tls-descseq.d} {objdump -Rw tls-descseq.r}} + "tls-lib2inline.so"} + {"TLS shared library gdesc local" "-shared -T arm-dyn.ld" "" {tls-lib-loc.s} + {{objdump -fdw tls-lib-loc.d} {objdump -Rw tls-lib-loc.r}} + "tls-lib-loc.so"} + {"TLS gnu GD to IE relaxation" "-static -T arm-dyn.ld" "" {tls-gdierelax.s} + {{objdump -fdw tls-gdierelax.d}} + "tls-app-rel-ie"} + {"TLS gnu GD to IE shared relaxation" "-shared -T arm-dyn.ld" "" {tls-gdierelax2.s} + {{objdump -fdw tls-gdierelax2.d}} + "tls-app-rel-ie2"} + {"TLS gnu GD to LE relaxation" "-T arm-dyn.ld" "" {tls-gdlerelax.s} + {{objdump -fdw tls-gdlerelax.d}} + "tls-app-rel-le"} + {"TLS mixed models shared lib" "-shared -T arm-dyn.ld" "" {tls-mixed.s} + {{objdump -Rw tls-mixed.r}} + "tls-mixed.so"} + {"TLS descseq relaxation" "-T arm-dyn.ld" "" {tls-descrelax.s} + {{objdump -fdw tls-descrelax.d}} + "tls-descrelax"} + {"TLS descseq relaxation v7" "-T arm-dyn.ld" "" {tls-descrelax-v7.s} + {{objdump -fdw tls-descrelax-v7.d}} + "tls-descrelax-v7"} + {"TLS descseq relaxation BE8" "-T arm-dyn.ld -EB --be8" "-mbig-endian" {tls-descrelax-be8.s} + {{objdump -fdw tls-descrelax-be8.d}} + "tls-descrelax-be8"} + {"TLS descseq relaxation BE32" "-T arm-dyn.ld -EB" "-mbig-endian" {tls-descrelax-be32.s} + {{objdump -fdw tls-descrelax-be32.d}} + "tls-descrelax-be32"} {"Thumb entry point" "-T arm.ld" "" {thumb-entry.s} {{readelf -h thumb-entry.d}} "thumb-entry"} @@ -481,6 +514,21 @@ set armeabitests { {jump-reloc-veneers.s} {{objdump -d jump-reloc-veneers-long.d}} "jump-reloc-veneers-long"} + {"TLS gnu shared library" "-shared -T arm-dyn.ld" "" {tls-gdesc.s} + {{objdump -fdw tls-gdesc.d} {objdump -Rw tls-gdesc.r}} + "tls-lib2.so"} + {"TLS gnu shared library non-lazy" "-z now -shared -T arm-dyn.ld" "" {tls-gdesc.s} + {{readelf "-x .got" tls-gdesc-nlazy.g}} + "tls-lib2-nlazy.so"} + {"TLS long plt library" "-shared -T arm-dyn.ld --section-start .foo=0x4001000" "" {tls-longplt-lib.s} + {{objdump -fdw tls-longplt-lib.d}} + "tls-longplt-lib.so"} + {"TLS long plt" "-T arm-dyn.ld --section-start .foo=0x4001000 tmpdir/tls-longplt-lib.so" "" {tls-longplt.s} + {{objdump -fdw tls-longplt.d}} + "tls-longplt"} + {"TLS thumb1" "-shared -T arm-dyn.ld --section-start .foo=0x4001000" "" {tls-thumb1.s} + {{objdump -fdw tls-thumb1.d}} + "tls-thumb1"} } run_ld_link_tests $armeabitests diff --git a/ld/testsuite/ld-arm/tls-descrelax-be32.d b/ld/testsuite/ld-arm/tls-descrelax-be32.d new file mode 100644 index 0000000..150e331 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-descrelax-be32.d @@ -0,0 +1,108 @@ +.*: file format elf32-.* +architecture: arm, flags 0x[0-9a-f]+: +EXEC_P, HAS_SYMS, D_PAGED +start address 0x[0-9a-f]+ + +Disassembly of section .text: + +00008000 <foo>: + 8000: e59f0004 ldr r0, \[pc, #4\] ; 800c <foo\+0xc> + 8004: e79f0000 ldr r0, \[pc, r0\] + 8008: e1a00000 nop ; .* + 800c: 00008138 .word 0x00008138 + 8010: e59f0004 ldr r0, \[pc, #4\] ; 801c <foo\+0x1c> + 8014: e79f0000 ldr r0, \[pc, r0\] + 8018: e1a00000 nop ; .* + 801c: 00008128 .word 0x00008128 + 8020: e59f0004 ldr r0, \[pc, #4\] ; 802c <foo\+0x2c> + 8024: e1a00000 nop ; .* + 8028: e1a00000 nop ; .* + 802c: 0000000c .word 0x0000000c + 8030: e59f0004 ldr r0, \[pc, #4\] ; 803c <foo\+0x3c> + 8034: e1a00000 nop ; .* + 8038: e1a00000 nop ; .* + 803c: 0000000c .word 0x0000000c + 8040: e59f000c ldr r0, \[pc, #12\] ; 8054 <foo\+0x54> + 8044: e08f0000 add r0, pc, r0 + 8048: e5901000 ldr r1, \[r0\] + 804c: e1a00001 mov r0, r1 + 8050: e1a00000 nop ; .* + 8054: 000080f8 .word 0x000080f8 + 8058: e59f000c ldr r0, \[pc, #12\] ; 806c <foo\+0x6c> + 805c: e08f0000 add r0, pc, r0 + 8060: e5901000 ldr r1, \[r0\] + 8064: e1a00001 mov r0, r1 + 8068: e1a00000 nop ; .* + 806c: 000080e0 .word 0x000080e0 + 8070: e59f000c ldr r0, \[pc, #12\] ; 8084 <foo\+0x84> + 8074: e1a00000 nop ; .* + 8078: e1a00000 nop ; .* + 807c: e1a00000 nop ; .* + 8080: e1a00000 nop ; .* + 8084: 0000000c .word 0x0000000c + 8088: e59f000c ldr r0, \[pc, #12\] ; 809c <foo\+0x9c> + 808c: e1a00000 nop ; .* + 8090: e1a00000 nop ; .* + 8094: e1a00000 nop ; .* + 8098: e1a00000 nop ; .* + 809c: 0000000c .word 0x0000000c + +000080a0 <bar>: + 80a0: 4801 ldr r0, \[pc, #4\] ; \(80a8 <bar\+0x8>\) + 80a2: 4478 add r0, pc + 80a4: 6800 ldr r0, \[r0, #0\] + 80a6: 46c0 nop ; .* + 80a8: 0000809e .word 0x0000809e + 80ac: 4801 ldr r0, \[pc, #4\] ; \(80b4 <bar\+0x14>\) + 80ae: 4478 add r0, pc + 80b0: 6800 ldr r0, \[r0, #0\] + 80b2: 46c0 nop ; .* + 80b4: 00008092 .word 0x00008092 + 80b8: 4801 ldr r0, \[pc, #4\] ; \(80c0 <bar\+0x20>\) + 80ba: 4478 add r0, pc + 80bc: 6800 ldr r0, \[r0, #0\] + 80be: 46c0 nop ; .* + 80c0: 0000808a .word 0x0000808a + 80c4: 4801 ldr r0, \[pc, #4\] ; \(80cc <bar\+0x2c>\) + 80c6: 46c0 nop ; .* + 80c8: 46c0 nop ; .* + 80ca: 46c0 nop ; .* + 80cc: 0000000c .word 0x0000000c + 80d0: 4801 ldr r0, \[pc, #4\] ; \(80d8 <bar\+0x38>\) + 80d2: bf00 nop + 80d4: bf00 nop + 80d6: 46c0 nop ; .* + 80d8: 0000000c .word 0x0000000c + 80dc: 4801 ldr r0, \[pc, #4\] ; \(80e4 <bar\+0x44>\) + 80de: bf00 nop + 80e0: bf00 nop + 80e2: 46c0 nop ; .* + 80e4: 00000014 .word 0x00000014 + 80e8: 4802 ldr r0, \[pc, #8\] ; \(80f4 <bar\+0x54>\) + 80ea: 4478 add r0, pc + 80ec: 6801 ldr r1, \[r0, #0\] + 80ee: 1c08 adds r0, r1, #0 + 80f0: 46c0 nop ; .* + 80f2: 46c0 nop ; .* + 80f4: 00008056 .word 0x00008056 + 80f8: 4802 ldr r0, \[pc, #8\] ; \(8104 <bar\+0x64>\) + 80fa: 4478 add r0, pc + 80fc: 6801 ldr r1, \[r0, #0\] + 80fe: 4608 mov r0, r1 + 8100: 46c0 nop ; .* + 8102: 46c0 nop ; .* + 8104: 00008046 .word 0x00008046 + 8108: 4802 ldr r0, \[pc, #8\] ; \(8114 <bar\+0x74>\) + 810a: 46c0 nop ; .* + 810c: 46c0 nop ; .* + 810e: 46c0 nop ; .* + 8110: 46c0 nop ; .* + 8112: 46c0 nop ; .* + 8114: 0000000c .word 0x0000000c + 8118: 4802 ldr r0, \[pc, #8\] ; \(8124 <bar\+0x84>\) + 811a: 46c0 nop ; .* + 811c: 46c0 nop ; .* + 811e: 46c0 nop ; .* + 8120: 46c0 nop ; .* + 8122: 46c0 nop ; .* + 8124: 0000000c .word 0x0000000c diff --git a/ld/testsuite/ld-arm/tls-descrelax-be32.s b/ld/testsuite/ld-arm/tls-descrelax-be32.s new file mode 100644 index 0000000..dae5458 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-descrelax-be32.s @@ -0,0 +1,198 @@ +@ we can relax local and non-weak globals for non-shared links + + .arch armv5te + .text + .arm + + .p2align 2 +foo: +@tlscall global, manually relaxed to IE + ldr r0, 1f +2: ldr r0, [pc, r0] + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 8) + + .p2align 2 +@tlscall global, should relax to IE + ldr r0, 1f +2: blx gd1(tlscall) + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b) + + .p2align 2 +@tlscall local, manually relaxed to LE + ldr r0, 1f + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 2 +@tlscall local, should relax to LE + ldr r0, 1f +2: blx ld1(tlscall) + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b) + + .p2align 2 +@open coded global, manually relaxed to IE + ldr r0, 1f +2: + add r0, pc, r0 + ldr r1, [r0] + mov r0, r1 + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 8) + + .p2align 2 +@open coded global, should relax to IE + ldr r0, 1f +2: +.tlsdescseq gd1 + add r0, pc, r0 +.tlsdescseq gd1 + ldr r1, [r0,#4] +.tlsdescseq gd1 + blx r1 + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b) + + .p2align 2 +@open coded local, manually relaxed to LE + ldr r0, 1f +2: + nop + nop + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 2 +@open coded local, should relax to LE + ldr r0, 1f +2: +.tlsdescseq ld1 + add r0, pc, r0 +.tlsdescseq ld1 + ldr r1, [r0,#4] +.tlsdescseq ld1 + blx r1 + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b) + + + .thumb + .p2align 1 +bar: +@tlscall global, manually relaxed to IE + ldr r0, 1f +2: add r0, pc, r0 + ldr r0, [r0] + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 4) + + .p2align 1 +@tlscall global, should relax to IE + ldr r0, 1f +2: blx gd1(tlscall) + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@tlscall global, should relax to IE + ldr r0, 1f +2: blx r1(tlscall) + nop + .p2align 2 +1: .word r1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@tlscall local, manually relaxed to LE + ldr r0, 1f + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 1 +@tlscall local, should relax to LE + ldr r0, 1f +2: blx ld1(tlscall) + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@tlscall local, should relax to LE + ldr r0, 1f +2: blx r0(tlscall) + nop + .p2align 2 +1: .word r0(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@open coded global, manually relaxed to IE + ldr r0, 1f +2: + add r0, pc + ldr r1, [r0] + mov r0, r1 + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 4) + + .p2align 1 +@open coded global, should relax to IE + ldr r0, 1f +2: +.tlsdescseq gd1 + add r0, pc +.tlsdescseq gd1 + ldr r1, [r0,#4] +.tlsdescseq gd1 + blx r1 + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@open coded local, manually relaxed to LE + ldr r0, 1f +2: + nop + nop + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 1 +@open coded local, should relax to LE + ldr r0, 1f +2: +.tlsdescseq ld1 + add r0, pc +.tlsdescseq ld1 + ldr r1, [r0,#4] +.tlsdescseq ld1 + blx r1 + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b + 1) + + .section .tdata,"awT" + .global gd1 +gd1: .space 4 +ld1: .space 4 + .globl r1 +r1: .space 4 +r0: .space 4 diff --git a/ld/testsuite/ld-arm/tls-descrelax-be8.d b/ld/testsuite/ld-arm/tls-descrelax-be8.d new file mode 100644 index 0000000..1b2159c --- /dev/null +++ b/ld/testsuite/ld-arm/tls-descrelax-be8.d @@ -0,0 +1,108 @@ +.*: file format elf32-.* +architecture: arm, flags 0x[0-9a-f]+: +EXEC_P, HAS_SYMS, D_PAGED +start address 0x[0-9a-f]+ + +Disassembly of section .text: + +00008000 <foo>: + 8000: e59f0004 ldr r0, \[pc, #4\] ; 800c <foo\+0xc> + 8004: e79f0000 ldr r0, \[pc, r0\] + 8008: e320f000 nop \{0\} + 800c: 00008138 .word 0x00008138 + 8010: e59f0004 ldr r0, \[pc, #4\] ; 801c <foo\+0x1c> + 8014: e79f0000 ldr r0, \[pc, r0\] + 8018: e320f000 nop \{0\} + 801c: 00008128 .word 0x00008128 + 8020: e59f0004 ldr r0, \[pc, #4\] ; 802c <foo\+0x2c> + 8024: e320f000 nop \{0\} + 8028: e320f000 nop \{0\} + 802c: 0000000c .word 0x0000000c + 8030: e59f0004 ldr r0, \[pc, #4\] ; 803c <foo\+0x3c> + 8034: e1a00000 nop ; .* + 8038: e320f000 nop \{0\} + 803c: 0000000c .word 0x0000000c + 8040: e59f000c ldr r0, \[pc, #12\] ; 8054 <foo\+0x54> + 8044: e08f0000 add r0, pc, r0 + 8048: e5901000 ldr r1, \[r0\] + 804c: e1a00001 mov r0, r1 + 8050: e320f000 nop \{0\} + 8054: 000080f8 .word 0x000080f8 + 8058: e59f000c ldr r0, \[pc, #12\] ; 806c <foo\+0x6c> + 805c: e08f0000 add r0, pc, r0 + 8060: e5901000 ldr r1, \[r0\] + 8064: e1a00001 mov r0, r1 + 8068: e320f000 nop \{0\} + 806c: 000080e0 .word 0x000080e0 + 8070: e59f000c ldr r0, \[pc, #12\] ; 8084 <foo\+0x84> + 8074: e320f000 nop \{0\} + 8078: e320f000 nop \{0\} + 807c: e320f000 nop \{0\} + 8080: e320f000 nop \{0\} + 8084: 0000000c .word 0x0000000c + 8088: e59f000c ldr r0, \[pc, #12\] ; 809c <foo\+0x9c> + 808c: e1a00000 nop ; .* + 8090: e1a00000 nop ; .* + 8094: e1a00000 nop ; .* + 8098: e320f000 nop \{0\} + 809c: 0000000c .word 0x0000000c + +000080a0 <bar>: + 80a0: 4801 ldr r0, \[pc, #4\] ; \(80a8 <bar\+0x8>\) + 80a2: 4478 add r0, pc + 80a4: 6800 ldr r0, \[r0, #0\] + 80a6: 46c0 nop ; .* + 80a8: 0000809e .word 0x0000809e + 80ac: 4801 ldr r0, \[pc, #4\] ; \(80b4 <bar\+0x14>\) + 80ae: 4478 add r0, pc + 80b0: 6800 ldr r0, \[r0, #0\] + 80b2: 46c0 nop ; \(mov r8, r8\) + 80b4: 00008092 .word 0x00008092 + 80b8: 4801 ldr r0, \[pc, #4\] ; \(80c0 <bar\+0x20>\) + 80ba: 4478 add r0, pc + 80bc: 6800 ldr r0, \[r0, #0\] + 80be: 46c0 nop ; \(mov r8, r8\) + 80c0: 0000808a .word 0x0000808a + 80c4: 4801 ldr r0, \[pc, #4\] ; \(80cc <bar\+0x2c>\) + 80c6: 46c0 nop ; \(mov r8, r8\) + 80c8: 46c0 nop ; \(mov r8, r8\) + 80ca: bf00 nop + 80cc: 0000000c .word 0x0000000c + 80d0: 4801 ldr r0, \[pc, #4\] ; \(80d8 <bar\+0x38>\) + 80d2: (f3af 8000)|(bf00 ) nop(.w)? +#... + 80d6: 46c0 nop ; \(mov r8, r8\) + 80d8: 0000000c .word 0x0000000c + 80dc: 4801 ldr r0, \[pc, #4\] ; \(80e4 <bar\+0x44>\) + 80de: (f3af 8000)|(bf00 ) nop(.w)? +#... + 80e2: 46c0 nop ; \(mov r8, r8\) + 80e4: 00000014 .word 0x00000014 + 80e8: 4802 ldr r0, \[pc, #8\] ; \(80f4 <bar\+0x54>\) + 80ea: 4478 add r0, pc + 80ec: 6801 ldr r1, \[r0, #0\] + 80ee: 1c08 adds r0, r1, #0 + 80f0: 46c0 nop ; \(mov r8, r8\) + 80f2: bf00 nop + 80f4: 00008056 .word 0x00008056 + 80f8: 4802 ldr r0, \[pc, #8\] ; \(8104 <bar\+0x64>\) + 80fa: 4478 add r0, pc + 80fc: 6801 ldr r1, \[r0, #0\] + 80fe: 4608 mov r0, r1 + 8100: 46c0 nop ; \(mov r8, r8\) + 8102: bf00 nop + 8104: 00008046 .word 0x00008046 + 8108: 4802 ldr r0, \[pc, #8\] ; \(8114 <bar\+0x74>\) + 810a: 46c0 nop ; \(mov r8, r8\) + 810c: 46c0 nop ; \(mov r8, r8\) + 810e: 46c0 nop ; \(mov r8, r8\) + 8110: 46c0 nop ; \(mov r8, r8\) + 8112: bf00 nop + 8114: 0000000c .word 0x0000000c + 8118: 4802 ldr r0, \[pc, #8\] ; \(8124 <bar\+0x84>\) + 811a: 46c0 nop ; \(mov r8, r8\) + 811c: 46c0 nop ; \(mov r8, r8\) + 811e: 46c0 nop ; \(mov r8, r8\) + 8120: 46c0 nop ; \(mov r8, r8\) + 8122: bf00 nop + 8124: 0000000c .word 0x0000000c diff --git a/ld/testsuite/ld-arm/tls-descrelax-be8.s b/ld/testsuite/ld-arm/tls-descrelax-be8.s new file mode 100644 index 0000000..a8c028b --- /dev/null +++ b/ld/testsuite/ld-arm/tls-descrelax-be8.s @@ -0,0 +1,198 @@ +@ we can relax local and non-weak globals for non-shared links + + .arch armv7-a + .text + .arm + + .p2align 2 +foo: +@tlscall global, manually relaxed to IE + ldr r0, 1f +2: ldr r0, [pc, r0] + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 8) + + .p2align 2 +@tlscall global, should relax to IE + ldr r0, 1f +2: blx gd1(tlscall) + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b) + + .p2align 2 +@tlscall local, manually relaxed to LE + ldr r0, 1f + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 2 +@tlscall local, should relax to LE + ldr r0, 1f +2: blx ld1(tlscall) + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b) + + .p2align 2 +@open coded global, manually relaxed to IE + ldr r0, 1f +2: + add r0, pc, r0 + ldr r1, [r0] + mov r0, r1 + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 8) + + .p2align 2 +@open coded global, should relax to IE + ldr r0, 1f +2: +.tlsdescseq gd1 + add r0, pc, r0 +.tlsdescseq gd1 + ldr r1, [r0,#4] +.tlsdescseq gd1 + blx r1 + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b) + + .p2align 2 +@open coded local, manually relaxed to LE + ldr r0, 1f +2: + nop + nop + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 2 +@open coded local, should relax to LE + ldr r0, 1f +2: +.tlsdescseq ld1 + add r0, pc, r0 +.tlsdescseq ld1 + ldr r1, [r0,#4] +.tlsdescseq ld1 + blx r1 + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b) + + + .thumb + .p2align 1 +bar: +@tlscall global, manually relaxed to IE + ldr r0, 1f +2: add r0, pc, r0 + ldr r0, [r0] + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 4) + + .p2align 1 +@tlscall global, should relax to IE + ldr r0, 1f +2: blx gd1(tlscall) + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@tlscall global, should relax to IE + ldr r0, 1f +2: blx r1(tlscall) + nop + .p2align 2 +1: .word r1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@tlscall local, manually relaxed to LE + ldr r0, 1f + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 1 +@tlscall local, should relax to LE + ldr r0, 1f +2: blx ld1(tlscall) + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@tlscall local, should relax to LE + ldr r0, 1f +2: blx r0(tlscall) + nop + .p2align 2 +1: .word r0(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@open coded global, manually relaxed to IE + ldr r0, 1f +2: + add r0, pc + ldr r1, [r0] + mov r0, r1 + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 4) + + .p2align 1 +@open coded global, should relax to IE + ldr r0, 1f +2: +.tlsdescseq gd1 + add r0, pc +.tlsdescseq gd1 + ldr r1, [r0,#4] +.tlsdescseq gd1 + blx r1 + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@open coded local, manually relaxed to LE + ldr r0, 1f +2: + nop + nop + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 1 +@open coded local, should relax to LE + ldr r0, 1f +2: +.tlsdescseq ld1 + add r0, pc +.tlsdescseq ld1 + ldr r1, [r0,#4] +.tlsdescseq ld1 + blx r1 + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b + 1) + + .section .tdata,"awT" + .global gd1 +gd1: .space 4 +ld1: .space 4 + .globl r1 +r1: .space 4 +r0: .space 4 diff --git a/ld/testsuite/ld-arm/tls-descrelax-v7.d b/ld/testsuite/ld-arm/tls-descrelax-v7.d new file mode 100644 index 0000000..1b2159c --- /dev/null +++ b/ld/testsuite/ld-arm/tls-descrelax-v7.d @@ -0,0 +1,108 @@ +.*: file format elf32-.* +architecture: arm, flags 0x[0-9a-f]+: +EXEC_P, HAS_SYMS, D_PAGED +start address 0x[0-9a-f]+ + +Disassembly of section .text: + +00008000 <foo>: + 8000: e59f0004 ldr r0, \[pc, #4\] ; 800c <foo\+0xc> + 8004: e79f0000 ldr r0, \[pc, r0\] + 8008: e320f000 nop \{0\} + 800c: 00008138 .word 0x00008138 + 8010: e59f0004 ldr r0, \[pc, #4\] ; 801c <foo\+0x1c> + 8014: e79f0000 ldr r0, \[pc, r0\] + 8018: e320f000 nop \{0\} + 801c: 00008128 .word 0x00008128 + 8020: e59f0004 ldr r0, \[pc, #4\] ; 802c <foo\+0x2c> + 8024: e320f000 nop \{0\} + 8028: e320f000 nop \{0\} + 802c: 0000000c .word 0x0000000c + 8030: e59f0004 ldr r0, \[pc, #4\] ; 803c <foo\+0x3c> + 8034: e1a00000 nop ; .* + 8038: e320f000 nop \{0\} + 803c: 0000000c .word 0x0000000c + 8040: e59f000c ldr r0, \[pc, #12\] ; 8054 <foo\+0x54> + 8044: e08f0000 add r0, pc, r0 + 8048: e5901000 ldr r1, \[r0\] + 804c: e1a00001 mov r0, r1 + 8050: e320f000 nop \{0\} + 8054: 000080f8 .word 0x000080f8 + 8058: e59f000c ldr r0, \[pc, #12\] ; 806c <foo\+0x6c> + 805c: e08f0000 add r0, pc, r0 + 8060: e5901000 ldr r1, \[r0\] + 8064: e1a00001 mov r0, r1 + 8068: e320f000 nop \{0\} + 806c: 000080e0 .word 0x000080e0 + 8070: e59f000c ldr r0, \[pc, #12\] ; 8084 <foo\+0x84> + 8074: e320f000 nop \{0\} + 8078: e320f000 nop \{0\} + 807c: e320f000 nop \{0\} + 8080: e320f000 nop \{0\} + 8084: 0000000c .word 0x0000000c + 8088: e59f000c ldr r0, \[pc, #12\] ; 809c <foo\+0x9c> + 808c: e1a00000 nop ; .* + 8090: e1a00000 nop ; .* + 8094: e1a00000 nop ; .* + 8098: e320f000 nop \{0\} + 809c: 0000000c .word 0x0000000c + +000080a0 <bar>: + 80a0: 4801 ldr r0, \[pc, #4\] ; \(80a8 <bar\+0x8>\) + 80a2: 4478 add r0, pc + 80a4: 6800 ldr r0, \[r0, #0\] + 80a6: 46c0 nop ; .* + 80a8: 0000809e .word 0x0000809e + 80ac: 4801 ldr r0, \[pc, #4\] ; \(80b4 <bar\+0x14>\) + 80ae: 4478 add r0, pc + 80b0: 6800 ldr r0, \[r0, #0\] + 80b2: 46c0 nop ; \(mov r8, r8\) + 80b4: 00008092 .word 0x00008092 + 80b8: 4801 ldr r0, \[pc, #4\] ; \(80c0 <bar\+0x20>\) + 80ba: 4478 add r0, pc + 80bc: 6800 ldr r0, \[r0, #0\] + 80be: 46c0 nop ; \(mov r8, r8\) + 80c0: 0000808a .word 0x0000808a + 80c4: 4801 ldr r0, \[pc, #4\] ; \(80cc <bar\+0x2c>\) + 80c6: 46c0 nop ; \(mov r8, r8\) + 80c8: 46c0 nop ; \(mov r8, r8\) + 80ca: bf00 nop + 80cc: 0000000c .word 0x0000000c + 80d0: 4801 ldr r0, \[pc, #4\] ; \(80d8 <bar\+0x38>\) + 80d2: (f3af 8000)|(bf00 ) nop(.w)? +#... + 80d6: 46c0 nop ; \(mov r8, r8\) + 80d8: 0000000c .word 0x0000000c + 80dc: 4801 ldr r0, \[pc, #4\] ; \(80e4 <bar\+0x44>\) + 80de: (f3af 8000)|(bf00 ) nop(.w)? +#... + 80e2: 46c0 nop ; \(mov r8, r8\) + 80e4: 00000014 .word 0x00000014 + 80e8: 4802 ldr r0, \[pc, #8\] ; \(80f4 <bar\+0x54>\) + 80ea: 4478 add r0, pc + 80ec: 6801 ldr r1, \[r0, #0\] + 80ee: 1c08 adds r0, r1, #0 + 80f0: 46c0 nop ; \(mov r8, r8\) + 80f2: bf00 nop + 80f4: 00008056 .word 0x00008056 + 80f8: 4802 ldr r0, \[pc, #8\] ; \(8104 <bar\+0x64>\) + 80fa: 4478 add r0, pc + 80fc: 6801 ldr r1, \[r0, #0\] + 80fe: 4608 mov r0, r1 + 8100: 46c0 nop ; \(mov r8, r8\) + 8102: bf00 nop + 8104: 00008046 .word 0x00008046 + 8108: 4802 ldr r0, \[pc, #8\] ; \(8114 <bar\+0x74>\) + 810a: 46c0 nop ; \(mov r8, r8\) + 810c: 46c0 nop ; \(mov r8, r8\) + 810e: 46c0 nop ; \(mov r8, r8\) + 8110: 46c0 nop ; \(mov r8, r8\) + 8112: bf00 nop + 8114: 0000000c .word 0x0000000c + 8118: 4802 ldr r0, \[pc, #8\] ; \(8124 <bar\+0x84>\) + 811a: 46c0 nop ; \(mov r8, r8\) + 811c: 46c0 nop ; \(mov r8, r8\) + 811e: 46c0 nop ; \(mov r8, r8\) + 8120: 46c0 nop ; \(mov r8, r8\) + 8122: bf00 nop + 8124: 0000000c .word 0x0000000c diff --git a/ld/testsuite/ld-arm/tls-descrelax-v7.s b/ld/testsuite/ld-arm/tls-descrelax-v7.s new file mode 100644 index 0000000..a8c028b --- /dev/null +++ b/ld/testsuite/ld-arm/tls-descrelax-v7.s @@ -0,0 +1,198 @@ +@ we can relax local and non-weak globals for non-shared links + + .arch armv7-a + .text + .arm + + .p2align 2 +foo: +@tlscall global, manually relaxed to IE + ldr r0, 1f +2: ldr r0, [pc, r0] + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 8) + + .p2align 2 +@tlscall global, should relax to IE + ldr r0, 1f +2: blx gd1(tlscall) + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b) + + .p2align 2 +@tlscall local, manually relaxed to LE + ldr r0, 1f + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 2 +@tlscall local, should relax to LE + ldr r0, 1f +2: blx ld1(tlscall) + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b) + + .p2align 2 +@open coded global, manually relaxed to IE + ldr r0, 1f +2: + add r0, pc, r0 + ldr r1, [r0] + mov r0, r1 + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 8) + + .p2align 2 +@open coded global, should relax to IE + ldr r0, 1f +2: +.tlsdescseq gd1 + add r0, pc, r0 +.tlsdescseq gd1 + ldr r1, [r0,#4] +.tlsdescseq gd1 + blx r1 + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b) + + .p2align 2 +@open coded local, manually relaxed to LE + ldr r0, 1f +2: + nop + nop + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 2 +@open coded local, should relax to LE + ldr r0, 1f +2: +.tlsdescseq ld1 + add r0, pc, r0 +.tlsdescseq ld1 + ldr r1, [r0,#4] +.tlsdescseq ld1 + blx r1 + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b) + + + .thumb + .p2align 1 +bar: +@tlscall global, manually relaxed to IE + ldr r0, 1f +2: add r0, pc, r0 + ldr r0, [r0] + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 4) + + .p2align 1 +@tlscall global, should relax to IE + ldr r0, 1f +2: blx gd1(tlscall) + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@tlscall global, should relax to IE + ldr r0, 1f +2: blx r1(tlscall) + nop + .p2align 2 +1: .word r1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@tlscall local, manually relaxed to LE + ldr r0, 1f + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 1 +@tlscall local, should relax to LE + ldr r0, 1f +2: blx ld1(tlscall) + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@tlscall local, should relax to LE + ldr r0, 1f +2: blx r0(tlscall) + nop + .p2align 2 +1: .word r0(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@open coded global, manually relaxed to IE + ldr r0, 1f +2: + add r0, pc + ldr r1, [r0] + mov r0, r1 + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 4) + + .p2align 1 +@open coded global, should relax to IE + ldr r0, 1f +2: +.tlsdescseq gd1 + add r0, pc +.tlsdescseq gd1 + ldr r1, [r0,#4] +.tlsdescseq gd1 + blx r1 + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@open coded local, manually relaxed to LE + ldr r0, 1f +2: + nop + nop + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 1 +@open coded local, should relax to LE + ldr r0, 1f +2: +.tlsdescseq ld1 + add r0, pc +.tlsdescseq ld1 + ldr r1, [r0,#4] +.tlsdescseq ld1 + blx r1 + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b + 1) + + .section .tdata,"awT" + .global gd1 +gd1: .space 4 +ld1: .space 4 + .globl r1 +r1: .space 4 +r0: .space 4 diff --git a/ld/testsuite/ld-arm/tls-descrelax.d b/ld/testsuite/ld-arm/tls-descrelax.d new file mode 100644 index 0000000..9b06d6a --- /dev/null +++ b/ld/testsuite/ld-arm/tls-descrelax.d @@ -0,0 +1,108 @@ +.*: file format elf32-.* +architecture: arm, flags 0x[0-9a-f]+: +EXEC_P, HAS_SYMS, D_PAGED +start address 0x[0-9a-f]+ + +Disassembly of section .text: + +00008000 <foo>: + 8000: e59f0004 ldr r0, \[pc, #4\] ; 800c <foo\+0xc> + 8004: e79f0000 ldr r0, \[pc, r0\] + 8008: e1a00000 nop ; \(mov r0, r0\) + 800c: 00008138 .word 0x00008138 + 8010: e59f0004 ldr r0, \[pc, #4\] ; 801c <foo\+0x1c> + 8014: e79f0000 ldr r0, \[pc, r0\] + 8018: e1a00000 nop ; \(mov r0, r0\) + 801c: 00008128 .word 0x00008128 + 8020: e59f0004 ldr r0, \[pc, #4\] ; 802c <foo\+0x2c> + 8024: e1a00000 nop ; \(mov r0, r0\) + 8028: e1a00000 nop ; \(mov r0, r0\) + 802c: 0000000c .word 0x0000000c + 8030: e59f0004 ldr r0, \[pc, #4\] ; 803c <foo\+0x3c> + 8034: e1a00000 nop ; \(mov r0, r0\) + 8038: e1a00000 nop ; \(mov r0, r0\) + 803c: 0000000c .word 0x0000000c + 8040: e59f000c ldr r0, \[pc, #12\] ; 8054 <foo\+0x54> + 8044: e08f0000 add r0, pc, r0 + 8048: e5901000 ldr r1, \[r0\] + 804c: e1a00001 mov r0, r1 + 8050: e1a00000 nop ; \(mov r0, r0\) + 8054: 000080f8 .word 0x000080f8 + 8058: e59f000c ldr r0, \[pc, #12\] ; 806c <foo\+0x6c> + 805c: e08f0000 add r0, pc, r0 + 8060: e5901000 ldr r1, \[r0\] + 8064: e1a00001 mov r0, r1 + 8068: e1a00000 nop ; \(mov r0, r0\) + 806c: 000080e0 .word 0x000080e0 + 8070: e59f000c ldr r0, \[pc, #12\] ; 8084 <foo\+0x84> + 8074: e1a00000 nop ; \(mov r0, r0\) + 8078: e1a00000 nop ; \(mov r0, r0\) + 807c: e1a00000 nop ; \(mov r0, r0\) + 8080: e1a00000 nop ; \(mov r0, r0\) + 8084: 0000000c .word 0x0000000c + 8088: e59f000c ldr r0, \[pc, #12\] ; 809c <foo\+0x9c> + 808c: e1a00000 nop ; \(mov r0, r0\) + 8090: e1a00000 nop ; \(mov r0, r0\) + 8094: e1a00000 nop ; \(mov r0, r0\) + 8098: e1a00000 nop ; \(mov r0, r0\) + 809c: 0000000c .word 0x0000000c + +000080a0 <bar>: + 80a0: 4801 ldr r0, \[pc, #4\] ; \(80a8 <bar\+0x8>\) + 80a2: 4478 add r0, pc + 80a4: 6800 ldr r0, \[r0, #0\] + 80a6: 46c0 nop ; \(mov r8, r8\) + 80a8: 0000809e .word 0x0000809e + 80ac: 4801 ldr r0, \[pc, #4\] ; \(80b4 <bar\+0x14>\) + 80ae: 4478 add r0, pc + 80b0: 6800 ldr r0, \[r0, #0\] + 80b2: 46c0 nop ; \(mov r8, r8\) + 80b4: 00008092 .word 0x00008092 + 80b8: 4801 ldr r0, \[pc, #4\] ; \(80c0 <bar\+0x20>\) + 80ba: 4478 add r0, pc + 80bc: 6800 ldr r0, \[r0, #0\] + 80be: 46c0 nop ; \(mov r8, r8\) + 80c0: 0000808a .word 0x0000808a + 80c4: 4801 ldr r0, \[pc, #4\] ; \(80cc <bar\+0x2c>\) + 80c6: 46c0 nop ; \(mov r8, r8\) + 80c8: 46c0 nop ; \(mov r8, r8\) + 80ca: 46c0 nop ; \(mov r8, r8\) + 80cc: 0000000c .word 0x0000000c + 80d0: 4801 ldr r0, \[pc, #4\] ; \(80d8 <bar\+0x38>\) + 80d2: bf00 nop + 80d4: bf00 nop + 80d6: 46c0 nop ; \(mov r8, r8\) + 80d8: 0000000c .word 0x0000000c + 80dc: 4801 ldr r0, \[pc, #4\] ; \(80e4 <bar\+0x44>\) + 80de: bf00 nop + 80e0: bf00 nop + 80e2: 46c0 nop ; \(mov r8, r8\) + 80e4: 00000014 .word 0x00000014 + 80e8: 4802 ldr r0, \[pc, #8\] ; \(80f4 <bar\+0x54>\) + 80ea: 4478 add r0, pc + 80ec: 6801 ldr r1, \[r0, #0\] + 80ee: 1c08 adds r0, r1, #0 + 80f0: 46c0 nop ; \(mov r8, r8\) + 80f2: 46c0 nop ; \(mov r8, r8\) + 80f4: 00008056 .word 0x00008056 + 80f8: 4802 ldr r0, \[pc, #8\] ; \(8104 <bar\+0x64>\) + 80fa: 4478 add r0, pc + 80fc: 6801 ldr r1, \[r0, #0\] + 80fe: 4608 mov r0, r1 + 8100: 46c0 nop ; \(mov r8, r8\) + 8102: 46c0 nop ; \(mov r8, r8\) + 8104: 00008046 .word 0x00008046 + 8108: 4802 ldr r0, \[pc, #8\] ; \(8114 <bar\+0x74>\) + 810a: 46c0 nop ; \(mov r8, r8\) + 810c: 46c0 nop ; \(mov r8, r8\) + 810e: 46c0 nop ; \(mov r8, r8\) + 8110: 46c0 nop ; \(mov r8, r8\) + 8112: 46c0 nop ; \(mov r8, r8\) + 8114: 0000000c .word 0x0000000c + 8118: 4802 ldr r0, \[pc, #8\] ; \(8124 <bar\+0x84>\) + 811a: 46c0 nop ; \(mov r8, r8\) + 811c: 46c0 nop ; \(mov r8, r8\) + 811e: 46c0 nop ; \(mov r8, r8\) + 8120: 46c0 nop ; \(mov r8, r8\) + 8122: 46c0 nop ; \(mov r8, r8\) + 8124: 0000000c .word 0x0000000c diff --git a/ld/testsuite/ld-arm/tls-descrelax.s b/ld/testsuite/ld-arm/tls-descrelax.s new file mode 100644 index 0000000..826f169 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-descrelax.s @@ -0,0 +1,197 @@ +@ we can relax local and non-weak globals for non-shared links + + .text + .arm + + .p2align 2 +foo: +@tlscall global, manually relaxed to IE + ldr r0, 1f +2: ldr r0, [pc, r0] + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 8) + + .p2align 2 +@tlscall global, should relax to IE + ldr r0, 1f +2: blx gd1(tlscall) + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b) + + .p2align 2 +@tlscall local, manually relaxed to LE + ldr r0, 1f + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 2 +@tlscall local, should relax to LE + ldr r0, 1f +2: blx ld1(tlscall) + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b) + + .p2align 2 +@open coded global, manually relaxed to IE + ldr r0, 1f +2: + add r0, pc, r0 + ldr r1, [r0] + mov r0, r1 + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 8) + + .p2align 2 +@open coded global, should relax to IE + ldr r0, 1f +2: +.tlsdescseq gd1 + add r0, pc, r0 +.tlsdescseq gd1 + ldr r1, [r0,#4] +.tlsdescseq gd1 + blx r1 + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b) + + .p2align 2 +@open coded local, manually relaxed to LE + ldr r0, 1f +2: + nop + nop + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 2 +@open coded local, should relax to LE + ldr r0, 1f +2: +.tlsdescseq ld1 + add r0, pc, r0 +.tlsdescseq ld1 + ldr r1, [r0,#4] +.tlsdescseq ld1 + blx r1 + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b) + + + .thumb + .p2align 1 +bar: +@tlscall global, manually relaxed to IE + ldr r0, 1f +2: add r0, pc, r0 + ldr r0, [r0] + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 4) + + .p2align 1 +@tlscall global, should relax to IE + ldr r0, 1f +2: blx gd1(tlscall) + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@tlscall global, should relax to IE + ldr r0, 1f +2: blx r1(tlscall) + nop + .p2align 2 +1: .word r1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@tlscall local, manually relaxed to LE + ldr r0, 1f + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 1 +@tlscall local, should relax to LE + ldr r0, 1f +2: blx ld1(tlscall) + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@tlscall local, should relax to LE + ldr r0, 1f +2: blx r0(tlscall) + nop + .p2align 2 +1: .word r0(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@open coded global, manually relaxed to IE + ldr r0, 1f +2: + add r0, pc + ldr r1, [r0] + mov r0, r1 + nop + .p2align 2 +1: .word gd1(gottpoff) + (. - 2b - 4) + + .p2align 1 +@open coded global, should relax to IE + ldr r0, 1f +2: +.tlsdescseq gd1 + add r0, pc +.tlsdescseq gd1 + ldr r1, [r0,#4] +.tlsdescseq gd1 + blx r1 + nop + .p2align 2 +1: .word gd1(tlsdesc) + (. - 2b + 1) + + .p2align 1 +@open coded local, manually relaxed to LE + ldr r0, 1f +2: + nop + nop + nop + nop + .p2align 2 +1: .word ld1(tpoff) + + .p2align 1 +@open coded local, should relax to LE + ldr r0, 1f +2: +.tlsdescseq ld1 + add r0, pc +.tlsdescseq ld1 + ldr r1, [r0,#4] +.tlsdescseq ld1 + blx r1 + nop + .p2align 2 +1: .word ld1(tlsdesc) + (. - 2b + 1) + + .section .tdata,"awT" + .global gd1 +gd1: .space 4 +ld1: .space 4 + .globl r1 +r1: .space 4 +r0: .space 4 diff --git a/ld/testsuite/ld-arm/tls-descseq.d b/ld/testsuite/ld-arm/tls-descseq.d new file mode 100644 index 0000000..1a04bb0 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-descseq.d @@ -0,0 +1,44 @@ + +tmpdir/tls-lib2inline.so: file format elf32-.*arm +architecture: arm, flags 0x[0-9a-f]+: +HAS_SYMS, DYNAMIC, D_PAGED +start address 0x[0-9a-f]+ + +Disassembly of section .plt: + +[0-9a-f]+ <.plt>: + [0-9a-f]+: e52de004 push {lr} ; .* + [0-9a-f]+: e59fe004 ldr lr, \[pc, #4\] ; .* + [0-9a-f]+: e08fe00e add lr, pc, lr + [0-9a-f]+: e5bef008 ldr pc, \[lr, #8\]! + [0-9a-f]+: 000080e4 .word 0x000080e4 + [0-9a-f]+: e08e0000 add r0, lr, r0 + [0-9a-f]+: e5901004 ldr r1, \[r0, #4\] + [0-9a-f]+: e12fff11 bx r1 + [0-9a-f]+: e52d2004 push {r2} ; .* + [0-9a-f]+: e59f200c ldr r2, \[pc, #12\] ; .* + [0-9a-f]+: e59f100c ldr r1, \[pc, #12\] ; .* + [0-9a-f]+: e79f2002 ldr r2, \[pc, r2\] + [0-9a-f]+: e081100f add r1, r1, pc + [0-9a-f]+: e12fff12 bx r2 + [0-9a-f]+: 000080d4 .word 0x000080d4 + [0-9a-f]+: 000080bc .word 0x000080bc + +Disassembly of section .text: + +[0-9a-f]+ <foo>: + [0-9a-f]+: e59f000c ldr r0, \[pc, #12\] ; .* + [0-9a-f]+: e08f0000 add r0, pc, r0 + [0-9a-f]+: e5901004 ldr r1, \[r0, #4\] + [0-9a-f]+: e12fff31 blx r1 + [0-9a-f]+: e1a00000 nop ; .* + [0-9a-f]+: 000080b4 .word 0x000080b4 + +[0-9a-f]+ <bar>: + [0-9a-f]+: 4802 ldr r0, \[pc, #8\] ; .* + [0-9a-f]+: 4478 add r0, pc + [0-9a-f]+: 6841 ldr r1, \[r0, #4\] + [0-9a-f]+: 4788 blx r1 + [0-9a-f]+: 46c0 nop ; .* + [0-9a-f]+: 46c0 nop ; .* + [0-9a-f]+: 000080a2 .word 0x000080a2 diff --git a/ld/testsuite/ld-arm/tls-descseq.r b/ld/testsuite/ld-arm/tls-descseq.r new file mode 100644 index 0000000..23d4637 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-descseq.r @@ -0,0 +1,6 @@ + +.*: file format elf32-.*arm + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +[0-9a-f]+ R_ARM_TLS_DESC lib_gd2 diff --git a/ld/testsuite/ld-arm/tls-descseq.s b/ld/testsuite/ld-arm/tls-descseq.s new file mode 100644 index 0000000..9b2628d --- /dev/null +++ b/ld/testsuite/ld-arm/tls-descseq.s @@ -0,0 +1,41 @@ + .text + .arm + .globl foo + .type foo, %function +foo: + ldr r0, 1f +2: +.tlsdescseq lib_gd2 + add r0, pc, r0 +.tlsdescseq lib_gd2 + ldr r1, [r0,#4] +.tlsdescseq lib_gd2 + blx r1 + nop + +1: + .word lib_gd2(tlsdesc) + (. - 2b) + + .thumb + .globl bar + .type bar, %function +bar: + ldr r0, 1f +2: +.tlsdescseq lib_gd2 + add r0, pc +.tlsdescseq lib_gd2 + ldr r1, [r0,#4] +.tlsdescseq lib_gd2 + blx r1 + nop + + .p2align 2 +1: + .word lib_gd2(tlsdesc) + (. - 2b + 1) + + .section .tdata,"awT" + .global lib_gd2 +lib_gd2: + .space 4 + diff --git a/ld/testsuite/ld-arm/tls-gdesc-got.d b/ld/testsuite/ld-arm/tls-gdesc-got.d new file mode 100644 index 0000000..3b4a83b --- /dev/null +++ b/ld/testsuite/ld-arm/tls-gdesc-got.d @@ -0,0 +1,30 @@ + +.*/tls-lib2-got.so: file format elf32-.*arm +architecture: arm, flags 0x00000150: +HAS_SYMS, DYNAMIC, D_PAGED +start address 0x00008210 + + +Disassembly of section .got: + +00010310 <.*>: + 10310: 00010288 .* + ... + 1031c: 00000008 .* + 1031c: R_ARM_TLS_DESC \*ABS\* + 10320: 00000000 .* + 10324: 0000000c .* + 10324: R_ARM_TLS_DESC \*ABS\* + 10328: 00000000 .* + 1032c: 80000004 .* + 1032c: R_ARM_TLS_DESC glob1 + 10330: 00000000 .* + 10334: 80000006 .* + 10334: R_ARM_TLS_DESC ext2 + 10338: 00000000 .* + 1033c: 80000007 .* + 1033c: R_ARM_TLS_DESC ext1 + 10340: 00000000 .* + 10344: 80000009 .* + 10344: R_ARM_TLS_DESC glob2 + ... diff --git a/ld/testsuite/ld-arm/tls-gdesc-got.s b/ld/testsuite/ld-arm/tls-gdesc-got.s new file mode 100644 index 0000000..8128ff7 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-gdesc-got.s @@ -0,0 +1,45 @@ + + .arm +foo: + ldr r0,1f +2: bl loc1(tlscall) + nop +1: .word loc1(tlsdesc) + (. - 2b) + + ldr r0,1f +2: bl loc2(tlscall) + nop +1: .word loc2(tlsdesc) + (. - 2b) + + ldr r0,1f +2: bl glob1(tlscall) + nop +1: .word glob1(tlsdesc) + (. - 2b) + + ldr r0,1f +2: bl glob2(tlscall) + nop +1: .word glob2(tlsdesc) + (. - 2b) + + ldr r0,1f +2: bl ext1(tlscall) + nop +1: .word ext1(tlsdesc) + (. - 2b) + + ldr r0,1f +2: bl ext2(tlscall) + nop +1: .word ext2(tlsdesc) + (. - 2b) + + .section .tdata,"awT",%progbits + .space 8 + .type loc1, %object +loc1: .space 4 + .type loc2, %object +loc2: .space 4 + .globl glob1 + .type glob1, %object +glob1: .space 4 + .globl glob2 + .type glob2, %object +glob2: .space 4 diff --git a/ld/testsuite/ld-arm/tls-gdesc-nlazy.g b/ld/testsuite/ld-arm/tls-gdesc-nlazy.g new file mode 100644 index 0000000..4b53a98 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-gdesc-nlazy.g @@ -0,0 +1,4 @@ + +Hex dump of section '.got': + 0x[0-9a-f]+ [0-9a-f]+ 00000000 00000000 00000000 ................ + 0x[0-9a-f]+ 00000000 00000000 00000000 ............ diff --git a/ld/testsuite/ld-arm/tls-gdesc-nlazy.s b/ld/testsuite/ld-arm/tls-gdesc-nlazy.s new file mode 100644 index 0000000..2cd8109 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-gdesc-nlazy.s @@ -0,0 +1,17 @@ + .text + .globl foo + .type foo, %function +foo: + nop +.L2: + blx lib_gd2(tlscall) + mov pc, lr + +.Lpool: + .word lib_gd2(tlsdesc) + (. - .L2) + + .section .tdata,"awT" + .global lib_gd2 +lib_gd2: + .space 4 + diff --git a/ld/testsuite/ld-arm/tls-gdesc.d b/ld/testsuite/ld-arm/tls-gdesc.d new file mode 100644 index 0000000..ce18eac --- /dev/null +++ b/ld/testsuite/ld-arm/tls-gdesc.d @@ -0,0 +1,42 @@ + +tmpdir/tls-lib2.so: file format elf32-.*arm +architecture: arm, flags 0x[0-9a-f]+: +HAS_SYMS, DYNAMIC, D_PAGED +start address 0x[0-9a-f]+ + +Disassembly of section .plt: + +[0-9a-f]+ <.plt>: + [0-9a-f]+: e52de004 push {lr} ; .* + [0-9a-f]+: e59fe004 ldr lr, \[pc, #4\] ; .* + [0-9a-f]+: e08fe00e add lr, pc, lr + [0-9a-f]+: e5bef008 ldr pc, \[lr, #8\]! + [0-9a-f]+: 000080e8 .word 0x000080e8 + [0-9a-f]+: e08e0000 add r0, lr, r0 + [0-9a-f]+: e5901004 ldr r1, \[r0, #4\] + [0-9a-f]+: e12fff11 bx r1 + [0-9a-f]+: e52d2004 push {r2} ; .* + [0-9a-f]+: e59f200c ldr r2, \[pc, #12\] ; .* + [0-9a-f]+: e59f100c ldr r1, \[pc, #12\] ; .* + [0-9a-f]+: e79f2002 ldr r2, \[pc, r2\] + [0-9a-f]+: e081100f add r1, r1, pc + [0-9a-f]+: e12fff12 bx r2 + [0-9a-f]+: 000080e0 .word 0x000080e0 + [0-9a-f]+: 000080c0 .word 0x000080c0 +Disassembly of section .text: + +[0-9a-f]+ <foo>: + [0-9a-f]+: e59f0004 ldr r0, \[pc, #4\] ; .* + [0-9a-f]+: fafffff2 blx [0-9a-f]+ .* + [0-9a-f]+: e1a00000 nop ; .* + [0-9a-f]+: 000080c4 .word 0x000080c4 + +[0-9a-f]+ <bar>: + [0-9a-f]+: 4801 ldr r0, \[pc, #4\] ; .* + [0-9a-f]+: f7ff efe0 blx [0-9a-f]+ .* + [0-9a-f]+: 46c0 nop ; .* + [0-9a-f]+: 000080b5 .word 0x000080b5 + [0-9a-f]+: 4801 ldr r0, \[pc, #4\] ; .* + [0-9a-f]+: f7ff efda blx [0-9a-f]+ .* + [0-9a-f]+: 46c0 nop ; .* + [0-9a-f]+: 000080a1 .word 0x000080a1 diff --git a/ld/testsuite/ld-arm/tls-gdesc.r b/ld/testsuite/ld-arm/tls-gdesc.r new file mode 100644 index 0000000..3de3ae8 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-gdesc.r @@ -0,0 +1,7 @@ + +.*: file format elf32-.*arm + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +[0-9a-f]+ R_ARM_TLS_DESC lib_gd2 +[0-9a-f]+ R_ARM_TLS_DESC r0 diff --git a/ld/testsuite/ld-arm/tls-gdesc.s b/ld/testsuite/ld-arm/tls-gdesc.s new file mode 100644 index 0000000..482ee29 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-gdesc.s @@ -0,0 +1,41 @@ + .text + .arm + .globl foo + .type foo, %function +foo: + ldr r0,1f +2: + blx lib_gd2(tlscall) + nop + +1: + .word lib_gd2(tlsdesc) + (. - 2b) + + .thumb + .globl bar + .type bar, %function +bar: + ldr r0,1f +2: + blx lib_gd2(tlscall) + nop + + .p2align 2 +1: + .word lib_gd2(tlsdesc) + (. - 2b + 1) + + ldr r0,1f +2: + blx r0(tlscall) + nop + + .p2align 2 +1: + .word r0(tlsdesc) + (. - 2b + 1) + + .section .tdata,"awT" + .global lib_gd2 +lib_gd2: + .space 4 + .globl r0 +r0: .space 4 diff --git a/ld/testsuite/ld-arm/tls-gdierelax.d b/ld/testsuite/ld-arm/tls-gdierelax.d new file mode 100644 index 0000000..8d965fc --- /dev/null +++ b/ld/testsuite/ld-arm/tls-gdierelax.d @@ -0,0 +1,20 @@ + +tmpdir/tls-app-rel-ie: file format elf32-.*arm +architecture: arm, flags 0x[0-9a-f]+: +EXEC_P, HAS_SYMS, D_PAGED +start address 0x[0-9a-f]+ + +Disassembly of section .text: + +[0-9a-f]+ <foo>: + [0-9a-f]+: e59f0004 ldr r0, \[pc, #4\] ; .* + [0-9a-f]+: e79f0000 ldr r0, \[pc, r0\] + [0-9a-f]+: e1a00000 nop ; .* + [0-9a-f]+: 00008020 .word 0x00008020 + +[0-9a-f]+ <bar>: + [0-9a-f]+: 4801 ldr r0, \[pc, #4\] ; .* + [0-9a-f]+: 4478 add r0, pc + [0-9a-f]+: 6800 ldr r0, \[r0, #0\] + [0-9a-f]+: 46c0 nop ; .* + [0-9a-f]+: 00008016 .word 0x00008016 diff --git a/ld/testsuite/ld-arm/tls-gdierelax.s b/ld/testsuite/ld-arm/tls-gdierelax.s new file mode 100644 index 0000000..db62008 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-gdierelax.s @@ -0,0 +1,34 @@ + .text + .arm + .globl foo + .type foo, %function +foo: + ldr r0, 1f +2: + blx lib_gd2(tlscall) + nop + +1: + .word lib_gd2(tlsdesc) + (. - 2b) + + .thumb + .globl bar + .type bar, %function +bar: + ldr r0,1f +2: + blx lib_gd2(tlscall) + nop + + .p2align 2 +1: + .word lib_gd2(tlsdesc) + (. - 2b + 1) + + .globl _start +_start: + + .section .tdata,"awT" + .global lib_gd2 +lib_gd2: + .space 4 + diff --git a/ld/testsuite/ld-arm/tls-gdierelax2.d b/ld/testsuite/ld-arm/tls-gdierelax2.d new file mode 100644 index 0000000..055aad8 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-gdierelax2.d @@ -0,0 +1,23 @@ + +tmpdir/tls-app-rel-ie2: file format elf32-.*arm +architecture: arm, flags 0x[0-9a-f]+: +HAS_SYMS, DYNAMIC, D_PAGED +start address 0x[0-9a-f]+ + +Disassembly of section .text: + +[0-9a-f]+ <foo>: + [0-9a-f]+: e1a00000 nop ; .* + [0-9a-f]+: e59f0004 ldr r0, \[pc, #4\] ; .* + [0-9a-f]+: e79f0000 ldr r0, \[pc, r0\] + [0-9a-f]+: e1a00000 nop ; .* + [0-9a-f]+: 00008098 .word 0x00008098 + [0-9a-f]+: 0000809c .word 0x0000809c + +[0-9a-f]+ <bar>: + [0-9a-f]+: 4801 ldr r0, \[pc, #4\] ; .* + [0-9a-f]+: 4478 add r0, pc + [0-9a-f]+: 6800 ldr r0, \[r0, #0\] + [0-9a-f]+: 46c0 nop ; .* + [0-9a-f]+: 0000808a .word 0x0000808a + [0-9a-f]+: 0000808c .word 0x0000808c diff --git a/ld/testsuite/ld-arm/tls-gdierelax2.s b/ld/testsuite/ld-arm/tls-gdierelax2.s new file mode 100644 index 0000000..2f4edad --- /dev/null +++ b/ld/testsuite/ld-arm/tls-gdierelax2.s @@ -0,0 +1,35 @@ + .text + .arm + .globl foo + .type foo, %function +foo: + nop +3: ldr r0,1f +2: bl lib_gd2(tlscall) + nop + +1: + .word lib_gd2(tlsdesc) + (. - 2b) + .word lib_gd2(gottpoff) + (. - 3b - 8) + + .thumb + .globl bar + .type bar, %function +bar: +3: ldr r0,1f +2: blx lib_gd2(tlscall) + nop + + .p2align 2 +1: + .word lib_gd2(tlsdesc) + (. - 2b + 1) + .word lib_gd2(gottpoff) + (. - 3b - 4) + + .globl _start +_start: + + .section .tdata,"awT" + .global lib_gd2 +lib_gd2: + .space 4 + diff --git a/ld/testsuite/ld-arm/tls-gdlerelax.d b/ld/testsuite/ld-arm/tls-gdlerelax.d new file mode 100644 index 0000000..896aed7 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-gdlerelax.d @@ -0,0 +1,13 @@ + +tmpdir/tls-app-rel-le: file format elf32-.*arm +architecture: arm, flags 0x[0-9a-f]+: +EXEC_P, HAS_SYMS, D_PAGED +start address 0x[0-9a-f]+ + +Disassembly of section .text: + +[0-9a-f]+ <foo>: + [0-9a-f]+: e1a00000 nop ; .* + [0-9a-f]+: e1a00000 nop ; .* + [0-9a-f]+: e1a0f00e mov pc, lr + [0-9a-f]+: 00000008 .word 0x00000008 diff --git a/ld/testsuite/ld-arm/tls-gdlerelax.s b/ld/testsuite/ld-arm/tls-gdlerelax.s new file mode 100644 index 0000000..3952837 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-gdlerelax.s @@ -0,0 +1,16 @@ + .text + .globl foo + .type foo, %function +foo: + nop +.L2: + blx lib_gd2(tlscall) + mov pc, lr + +.Lpool: + .word lib_gd2(tlsdesc) + (. - .L2) + + .section .tdata,"awT" +lib_gd2: + .space 4 + diff --git a/ld/testsuite/ld-arm/tls-lib-loc.d b/ld/testsuite/ld-arm/tls-lib-loc.d new file mode 100644 index 0000000..2235dcb --- /dev/null +++ b/ld/testsuite/ld-arm/tls-lib-loc.d @@ -0,0 +1,33 @@ + +.*: file format elf32-.*arm +architecture: arm, flags 0x00000150: +HAS_SYMS, DYNAMIC, D_PAGED +start address 0x.* + +Disassembly of section .plt: + +[0-9a-f]+ <.plt>: + [0-9a-f]+: e52de004 push {lr} ; .* + [0-9a-f]+: e59fe004 ldr lr, \[pc, #4\] ; 8150 .* + [0-9a-f]+: e08fe00e add lr, pc, lr + [0-9a-f]+: e5bef008 ldr pc, \[lr, #8\]! + 8150: 000080cc .word 0x000080cc + 8154: e08e0000 add r0, lr, r0 + [0-9a-f]+: e5901004 ldr r1, \[r0, #4\] + [0-9a-f]+: e12fff11 bx r1 + [0-9a-f]+: e52d2004 push {r2} ; .* + 8164: e59f200c ldr r2, \[pc, #12\] ; 8178 .* + [0-9a-f]+: e59f100c ldr r1, \[pc, #12\] ; 817c .* + [0-9a-f]+: e79f2002 ldr r2, \[pc, r2\] + [0-9a-f]+: e081100f add r1, r1, pc + [0-9a-f]+: e12fff12 bx r2 + 8178: 000080bc .word 0x000080bc + 817c: 000080a4 .word 0x000080a4 + +Disassembly of section .text: + +[0-9a-f]+ <foo>: + [0-9a-f]+: e59f0004 ldr r0, \[pc, #4\] ; 818c .* + [0-9a-f]+: fafffff2 blx 8154 <.*\+0x8154> + [0-9a-f]+: e1a00000 nop ; .* + 818c: 000080a0 .word 0x000080a0 diff --git a/ld/testsuite/ld-arm/tls-lib-loc.r b/ld/testsuite/ld-arm/tls-lib-loc.r new file mode 100644 index 0000000..ba54f61 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-lib-loc.r @@ -0,0 +1,6 @@ + +.*: file format elf32-.*arm + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +.* R_ARM_TLS_DESC \*ABS\* diff --git a/ld/testsuite/ld-arm/tls-lib-loc.s b/ld/testsuite/ld-arm/tls-lib-loc.s new file mode 100644 index 0000000..a0e4dc7 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-lib-loc.s @@ -0,0 +1,14 @@ + .text + .arm + +foo: + ldr r0,1f +2: blx loc(tlscall) + nop + + .p2align 2 +1: .word loc(tlsdesc) + (. - 2b) + + .section .tdata,"awT" +loc: + .space 4 diff --git a/ld/testsuite/ld-arm/tls-longplt-lib.d b/ld/testsuite/ld-arm/tls-longplt-lib.d new file mode 100644 index 0000000..9032c61 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-longplt-lib.d @@ -0,0 +1,59 @@ +.*: file format elf32-.*arm +architecture: arm, flags 0x00000150: +HAS_SYMS, DYNAMIC, D_PAGED +start address 0x.* + +Disassembly of section .plt: + +00008198 <.plt>: + 8198: e52de004 push {lr} ; .* + 819c: e59fe004 ldr lr, \[pc, #4\] ; .* + 81a0: e08fe00e add lr, pc, lr + 81a4: e5bef008 ldr pc, \[lr, #8\]! + 81a8: 000080e0 .word 0x000080e0 + 81ac: e08e0000 add r0, lr, r0 + 81b0: e5901004 ldr r1, \[r0, #4\] + 81b4: e12fff11 bx r1 + 81b8: e52d2004 push {r2} ; .* + 81bc: e59f200c ldr r2, \[pc, #12\] ; .* + 81c0: e59f100c ldr r1, \[pc, #12\] ; .* + 81c4: e79f2002 ldr r2, \[pc, r2\] + 81c8: e081100f add r1, r1, pc + 81cc: e12fff12 bx r2 + 81d0: 000080d8 .word 0x000080d8 + 81d4: 000080b8 .word 0x000080b8 + +Disassembly of section .text: + +000081d8 <text>: + 81d8: e59f0004 ldr r0, \[pc, #4\] ; .* + 81dc: fafffff2 blx 81ac .* + 81e0: e1a00000 nop ; .* + 81e4: 000080b4 .word 0x000080b4 + 81e8: 4801 ldr r0, \[pc, #4\] ; .* + 81ea: f7ff efe0 blx 81ac <.*> + 81ee: 46c0 nop ; .* + 81f0: 000080a5 .word 0x000080a5 + +Disassembly of section .foo: + +04001000 <foo>: + 4001000: e59f0004 ldr r0, \[pc, #4\] ; .* + 4001004: fa000009 blx 4001030 .* + 4001008: e1a00000 nop ; .* + 400100c: fc00f28c .word 0xfc00f28c + 4001010: e59f0004 ldr r0, \[pc, #4\] ; .* + 4001014: fa000005 blx 4001030 .* + 4001018: e1a00000 nop ; .* + 400101c: fc00f284 .word 0xfc00f284 + 4001020: 4801 ldr r0, \[pc, #4\] ; .* + 4001022: f000 e806 blx 4001030 .* + 4001026: 46c0 nop ; .* + 4001028: fc00f26d .word 0xfc00f26d + 400102c: 00000000 .word 0x00000000 + +04001030 <__unnamed_veneer>: + 4001030: e59f1000 ldr r1, \[pc, #0\] ; .* + 4001034: e08ff001 add pc, pc, r1 + 4001038: fc007170 .word 0xfc007170 + 400103c: 00000000 .word 0x00000000 diff --git a/ld/testsuite/ld-arm/tls-longplt-lib.s b/ld/testsuite/ld-arm/tls-longplt-lib.s new file mode 100644 index 0000000..e0650cb --- /dev/null +++ b/ld/testsuite/ld-arm/tls-longplt-lib.s @@ -0,0 +1,51 @@ + .syntax unified + .text +text: + .arm + ldr r0,1f +2: blx loc(tlscall) + nop + .p2align 2 +1: .word loc(tlsdesc) + (. - 2b) + + .thumb + ldr r0,1f +2: blx loc(tlscall) + nop + .p2align 2 +1: .word loc(tlsdesc) + (. - 2b + 1) + + .section ".foo","ax" +foo: + .arm + ldr r0,1f +2: blx loc(tlscall) + nop + .p2align 2 +1: .word loc(tlsdesc) + (. - 2b) + + .arm + ldr r0,1f +2: blx glob(tlscall) + nop + .p2align 2 +1: .word glob(tlsdesc) + (. - 2b) + + .thumb + ldr r0,1f +2: blx loc(tlscall) + nop + .p2align 2 +1: .word loc(tlsdesc) + (. - 2b + 1) + + .section .tdata,"awT" + .type loc, %object +loc: .space 4 + + @ glob1 and glob2 used by tls-longplt + .type glob1, %object + .globl glob1 +glob1: .space 4 + .type glob2, %object + .globl glob2 +glob2: .space 4 diff --git a/ld/testsuite/ld-arm/tls-longplt.d b/ld/testsuite/ld-arm/tls-longplt.d new file mode 100644 index 0000000..8729e74 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-longplt.d @@ -0,0 +1,64 @@ +.*: file format elf32-.*arm +architecture: arm, flags 0x00000112: +EXEC_P, HAS_SYMS, D_PAGED +start address 0x.* + +Disassembly of section .plt: + +0000819c <.plt>: + 819c: e52de004 push {lr} ; .* + 81a0: e59fe004 ldr lr, \[pc, #4\] ; .* + 81a4: e08fe00e add lr, pc, lr + 81a8: e5bef008 ldr pc, \[lr, #8\]! + 81ac: 00008100 .word 0x00008100 + 81b0: e08e0000 add r0, lr, r0 + 81b4: e5901004 ldr r1, \[r0, #4] + 81b8: e12fff11 bx r1 + 81bc: e52d2004 push {r2} ; .* + 81c0: e59f200c ldr r2, \[pc, #12\] ; .* + 81c4: e59f100c ldr r1, \[pc, #12\] ; .* + 81c8: e79f2002 ldr r2, \[pc, r2\] + 81cc: e081100f add r1, r1, pc + 81d0: e12fff12 bx r2 + 81d4: 000080f4 .word 0x000080f4 + 81d8: 000080d8 .word 0x000080d8 + +Disassembly of section .text: + +000081dc <text>: + 81dc: e59f0004 ldr r0, \[pc, #4\] ; .* + 81e0: fafffff2 blx 81b0 .* + 81e4: e1a00000 nop ; .* + 81e8: 000080d4 .word 0x000080d4 + 81ec: 4801 ldr r0, \[pc, #4\] ; .* + 81ee: f7ff efe0 blx 81b0 .* + 81f2: 46c0 nop ; .* + 81f4: 000080c5 .word 0x000080c5 + +Disassembly of section .foo: + +04001000 <foo>: + 4001000: e59f0004 ldr r0, \[pc, #4\] ; .* + 4001004: e79f0000 ldr r0, \[pc, r0\] + 4001008: e1a00000 nop ; .* + 400100c: fc00f2b4 .word 0xfc00f2b4 + 4001010: e59f0004 ldr r0, \[pc, #4\] ; .* + 4001014: fa000005 blx 4001030 .* + 4001018: e1a00000 nop ; .* + 400101c: fc00f2a0 .word 0xfc00f2a0 + 4001020: 4801 ldr r0, \[pc, #4\] ; .* + 4001022: f000 e80a blx 4001038 .* + 4001026: 46c0 nop ; .* + 4001028: fc00f291 .word 0xfc00f291 + 400102c: 00000000 .word 0x00000000 + +04001030 <__unnamed_veneer>: + 4001030: e51ff004 ldr pc, \[pc, #-4\] ; .* + 4001034: 000081b0 .word 0x000081b0 + +04001038 <__unnamed_veneer>: + 4001038: 4778 bx pc + 400103a: 46c0 nop ; .* + 400103c: e51ff004 ldr pc, \[pc, #-4\] ; .* + 4001040: 000081b0 .word 0x000081b0 + 4001044: 00000000 .word 0x00000000 diff --git a/ld/testsuite/ld-arm/tls-longplt.s b/ld/testsuite/ld-arm/tls-longplt.s new file mode 100644 index 0000000..42eea19 --- /dev/null +++ b/ld/testsuite/ld-arm/tls-longplt.s @@ -0,0 +1,47 @@ + .syntax unified + .text +text: + .arm + ldr r0,1f +2: blx udefw(tlscall) + nop + .p2align 2 +1: .word udefw(tlsdesc) + (. - 2b) + + .thumb + ldr r0,1f +2: blx udefw(tlscall) + nop + .p2align 2 +1: .word udefw(tlsdesc) + (. - 2b + 1) + + .section ".foo","ax" +foo: + .arm + ldr r0,1f +2: blx glob1(tlscall) + nop + .p2align 2 +1: .word glob1(tlsdesc) + (. - 2b) + + .arm + ldr r0,1f +2: blx udefw(tlscall) + nop + .p2align 2 +1: .word udefw(tlsdesc) + (. - 2b) + + .thumb + ldr r0,1f +2: blx udefw(tlscall) + nop + .p2align 2 +1: .word udefw(tlsdesc) + (. - 2b + 1) + + .section .tdata,"awT" + @ glob used by tls-longplt-lib + .type glob, %object + .globl glob +glob: .space 4 + .globl udefw + .weak udefw diff --git a/ld/testsuite/ld-arm/tls-mixed.r b/ld/testsuite/ld-arm/tls-mixed.r new file mode 100644 index 0000000..79ccdeb --- /dev/null +++ b/ld/testsuite/ld-arm/tls-mixed.r @@ -0,0 +1,10 @@ + +.*: file format elf32-.*arm + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +[0-9a-f]+ R_ARM_TLS_DTPMOD32 lib_gd2 +[0-9a-f]+ R_ARM_TLS_DTPOFF32 lib_gd2 +[0-9a-f]+ R_ARM_TLS_DTPMOD32 lib_gd +[0-9a-f]+ R_ARM_TLS_DTPOFF32 lib_gd +[0-9a-f]+ R_ARM_TLS_DESC lib_gd2 diff --git a/ld/testsuite/ld-arm/tls-mixed.s b/ld/testsuite/ld-arm/tls-mixed.s new file mode 100644 index 0000000..af2377d --- /dev/null +++ b/ld/testsuite/ld-arm/tls-mixed.s @@ -0,0 +1,25 @@ + .text + .globl foo + .type foo, %function +foo: + nop +.L1: + nop +.L2: + bl lib_gd2(tlscall) + mov pc, lr + +.Lpool: + .word lib_gd(tlsgd) + (. - .L1 - 8) +.Lpool2: + .word lib_gd2(tlsdesc) + (. - .L2) + .word lib_gd2(tlsgd) + (. - .L2 - 8) + + .section .tdata,"awT" + .global lib_gd +lib_gd: + .space 4 + .global lib_gd2 +lib_gd2: + .space 4 + diff --git a/ld/testsuite/ld-arm/tls-thumb1.d b/ld/testsuite/ld-arm/tls-thumb1.d new file mode 100644 index 0000000..26b65bb --- /dev/null +++ b/ld/testsuite/ld-arm/tls-thumb1.d @@ -0,0 +1,74 @@ +.*: file format elf32-.*arm +architecture: arm, flags 0x00000150: +HAS_SYMS, DYNAMIC, D_PAGED +start address 0x.* + +Disassembly of section .plt: + +00008164 <.plt>: + 8164: e52de004 push {lr} ; .* + 8168: e59fe004 ldr lr, \[pc, #4\] ; .* + 816c: e08fe00e add lr, pc, lr + 8170: e5bef008 ldr pc, \[lr, #8\]! + 8174: 000080f0 .word 0x000080f0 + 8178: e08e0000 add r0, lr, r0 + 817c: e5901004 ldr r1, \[r0, #4\] + 8180: e12fff11 bx r1 + 8184: e52d2004 push {r2} ; .* + 8188: e59f200c ldr r2, \[pc, #12\] ; .* + 818c: e59f100c ldr r1, \[pc, #12\] ; .* + 8190: e79f2002 ldr r2, \[pc, r2\] + 8194: e081100f add r1, r1, pc + 8198: e12fff12 bx r2 + 819c: 000080e8 .word 0x000080e8 + 81a0: 000080c8 .word 0x000080c8 + +Disassembly of section .text: + +000081a8 <text>: + 81a8: e59f0004 ldr r0, \[pc, #4\] ; .* + 81ac: ebfffff1 bl 8178 .* + 81b0: e1a00000 nop ; .* + 81b4: 000080c0 .word 0x000080c0 + 81b8: 4801 ldr r0, \[pc, #4\] ; .* + 81ba: f000 e806 blx 81c8 .* + 81be: 46c0 nop ; .* + 81c0: 000080b1 .word 0x000080b1 + 81c4: 00000000 .word 0x00000000 + +000081c8 <__unnamed_veneer>: + 81c8: 4778 bx pc + 81ca: 46c0 nop ; .* + 81cc: e59f1000 ldr r1, \[pc, #0\] ; .* + 81d0: e081f00f add pc, r1, pc + 81d4: ffffffa0 .word 0xffffffa0 + +Disassembly of section .foo: + +04001000 <foo>: + 4001000: e59f0004 ldr r0, \[pc, #4\] ; .* + 4001004: eb000009 bl 4001030 .* + 4001008: e1a00000 nop ; .* + 400100c: fc00f268 .word 0xfc00f268 + 4001010: e59f0004 ldr r0, \[pc, #4\] ; .* + 4001014: eb000005 bl 4001030 .* + 4001018: e1a00000 nop ; .* + 400101c: fc00f260 .word 0xfc00f260 + 4001020: 4801 ldr r0, \[pc, #4\] ; .* + 4001022: f000 e80c blx 400103c .* + 4001026: 46c0 nop ; .* + 4001028: fc00f249 .word 0xfc00f249 + 400102c: 00000000 .word 0x00000000 + +04001030 <__unnamed_veneer>: + 4001030: e59f1000 ldr r1, \[pc, #0\] ; .* + 4001034: e08ff001 add pc, pc, r1 + 4001038: fc00713c .word 0xfc00713c + +0400103c <__unnamed_veneer>: + 400103c: 4778 bx pc + 400103e: 46c0 nop ; .* + 4001040: e59f1000 ldr r1, \[pc, #0\] ; .* + 4001044: e081f00f add pc, r1, pc + 4001048: fc00712c .word 0xfc00712c + 400104c: 00000000 .word 0x00000000 diff --git a/ld/testsuite/ld-arm/tls-thumb1.s b/ld/testsuite/ld-arm/tls-thumb1.s new file mode 100644 index 0000000..634511e --- /dev/null +++ b/ld/testsuite/ld-arm/tls-thumb1.s @@ -0,0 +1,43 @@ + .arch armv4t + .syntax unified + .text +text: + .arm + ldr r0,1f +2: bl +loc(tlscall) + nop + .p2align 2 +1: .word loc(tlsdesc) + (. - 2b) + + .thumb + ldr r0,1f +2: bl +loc(tlscall) + nop + .p2align 2 +1: .word loc(tlsdesc) + (. - 2b + 1) + + .section ".foo","ax" +foo: + .arm + ldr r0,1f +2: bl +loc(tlscall) + nop + .p2align 2 +1: .word loc(tlsdesc) + (. - 2b) + + .arm + ldr r0,1f +2: bl +glob(tlscall) + nop + .p2align 2 +1: .word glob(tlsdesc) + (. - 2b) + + .thumb + ldr r0,1f +2: bl +loc(tlscall) + nop + .p2align 2 +1: .word loc(tlsdesc) + (. - 2b + 1) + + .section .tdata,"awT" +loc: .space 4 |