From 94a03f18b830422643115cfdae48aed9cdc5c485 Mon Sep 17 00:00:00 2001 From: Kaz Kojima Date: Fri, 11 Oct 2002 14:42:51 +0000 Subject: [PATCH] * gas/sh/tlsd.s, gas/sh/tlsd.d: New. * gas/sh/tlsnopic.s, gas/sh/tlsnopic.d: New. * gas/sh/tlspic.s, gas/sh/tlspic.d: New. * gas/sh/basic.exp: Add new tests. --- gas/testsuite/ChangeLog | 7 ++++ gas/testsuite/gas/sh/basic.exp | 7 ++++ gas/testsuite/gas/sh/tlsd.d | 55 +++++++++++++++++++++++++ gas/testsuite/gas/sh/tlsd.s | 71 +++++++++++++++++++++++++++++++++ gas/testsuite/gas/sh/tlsnopic.d | 20 ++++++++++ gas/testsuite/gas/sh/tlsnopic.s | 23 +++++++++++ gas/testsuite/gas/sh/tlspic.d | 33 +++++++++++++++ gas/testsuite/gas/sh/tlspic.s | 30 ++++++++++++++ 8 files changed, 246 insertions(+) create mode 100644 gas/testsuite/gas/sh/tlsd.d create mode 100644 gas/testsuite/gas/sh/tlsd.s create mode 100644 gas/testsuite/gas/sh/tlsnopic.d create mode 100644 gas/testsuite/gas/sh/tlsnopic.s create mode 100644 gas/testsuite/gas/sh/tlspic.d create mode 100644 gas/testsuite/gas/sh/tlspic.s diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index a9804404f5a..4064a8d1024 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2002-10-11 Kaz Kojima + + * gas/sh/tlsd.s, gas/sh/tlsd.d: New. + * gas/sh/tlsnopic.s, gas/sh/tlsnopic.d: New. + * gas/sh/tlspic.s, gas/sh/tlspic.d: New. + * gas/sh/basic.exp: Add new tests. + 2002-10-09 Stephen Clarke * gas/elf.exp: Don't run for sh64*-*-linux*, because it sets the diff --git a/gas/testsuite/gas/sh/basic.exp b/gas/testsuite/gas/sh/basic.exp index e0619746d84..6b8ebae3403 100644 --- a/gas/testsuite/gas/sh/basic.exp +++ b/gas/testsuite/gas/sh/basic.exp @@ -141,6 +141,13 @@ if [istarget sh*-*-*] then { if {[istarget sh*-*elf] || [istarget sh*-linux*]} then { run_dump_test "pic" + + # Test TLS. + run_dump_test "tlsd" + + run_dump_test "tlspic" + + run_dump_test "tlsnopic" } } diff --git a/gas/testsuite/gas/sh/tlsd.d b/gas/testsuite/gas/sh/tlsd.d new file mode 100644 index 00000000000..5ca4ef58dbf --- /dev/null +++ b/gas/testsuite/gas/sh/tlsd.d @@ -0,0 +1,55 @@ +#objdump: -dr +#as: -big +#name: sh dynamic tls + +.*: +file format .* + +Disassembly of section .text: + +0+000 : + 0: 2f c6 [ ]*mov\.l r12,@-r15 + 2: 2f e6 [ ]*mov\.l r14,@-r15 + 4: 4f 22 [ ]*sts\.l pr,@-r15 + 6: c7 14 [ ]*mova 58 ,r0 + 8: dc 13 [ ]*mov\.l 58 ,r12[ ]+! 0x0 + a: 3c 0c [ ]*add r0,r12 + c: 6e f3 [ ]*mov r15,r14 + e: d4 04 [ ]*mov\.l 20 ,r4[ ]+! 0x0 + 10: c7 04 [ ]*mova 24 ,r0 + 12: d1 04 [ ]*mov\.l 24 ,r1[ ]+! 0x0 + 14: 31 0c [ ]*add r0,r1 + 16: 41 0b [ ]*jsr @r1 + 18: 34 cc [ ]*add r12,r4 + 1a: a0 05 [ ]*bra 28 + 1c: 00 09 [ ]*nop + 1e: 00 09 [ ]*nop + \.\.\. +[ ]+20: R_SH_TLS_GD_32 foo +[ ]+24: R_SH_PLT32 __tls_get_addr + 28: d4 03 [ ]*mov\.l 38 ,r4[ ]+! 0x0 + 2a: c7 04 [ ]*mova 3c ,r0 + 2c: d1 03 [ ]*mov\.l 3c ,r1[ ]+! 0x0 + 2e: 31 0c [ ]*add r0,r1 + 30: 41 0b [ ]*jsr @r1 + 32: 34 cc [ ]*add r12,r4 + 34: a0 04 [ ]*bra 40 + 36: 00 09 [ ]*nop + \.\.\. +[ ]+38: R_SH_TLS_LD_32 bar +[ ]+3c: R_SH_PLT32 __tls_get_addr + 40: e2 01 [ ]*mov #1,r2 + 42: d1 06 [ ]*mov\.l 5c ,r1[ ]+! 0x0 + 44: 30 1c [ ]*add r1,r0 + 46: 20 22 [ ]*mov\.l r2,@r0 + 48: d1 05 [ ]*mov\.l 60 ,r1[ ]+! 0x0 + 4a: 30 1c [ ]*add r1,r0 + 4c: 6f e3 [ ]*mov r14,r15 + 4e: 4f 26 [ ]*lds\.l @r15\+,pr + 50: 6e f6 [ ]*mov\.l @r15\+,r14 + 52: 00 0b [ ]*rts + 54: 6c f6 [ ]*mov\.l @r15\+,r12 + 56: 00 09 [ ]*nop + \.\.\. +[ ]+58: R_SH_GOTPC _GLOBAL_OFFSET_TABLE_ +[ ]+5c: R_SH_TLS_LDO_32 bar +[ ]+60: R_SH_TLS_LDO_32 baz diff --git a/gas/testsuite/gas/sh/tlsd.s b/gas/testsuite/gas/sh/tlsd.s new file mode 100644 index 00000000000..8bf4f4e0e57 --- /dev/null +++ b/gas/testsuite/gas/sh/tlsd.s @@ -0,0 +1,71 @@ + .section .tbss,"awT",@nobits + .align 2 + .global foo, bar + .hidden bar +foo: .long 25 +bar: .long 27 +baz: .long 29 + .text + .align 1 + .global fn + .type fn, @function +fn: + mov.l r12,@-r15 + mov.l r14,@-r15 + sts.l pr,@-r15 + mova .L3,r0 + mov.l .L3,r12 + add r0,r12 + mov r15,r14 + + ! Dynamic TLS model, foo not known to be in the current object + mov.l 1f,r4 + mova 2f,r0 + mov.l 2f,r1 + add r0,r1 + jsr @r1 + add r12,r4 + bra 3f + nop + .align 2 +1: .long foo@TLSGD +2: .long __tls_get_addr@PLT +3: + + ! Dynamic TLS model, bar and baz known to be in the current object + mov.l 1f,r4 + mova 2f,r0 + mov.l 2f,r1 + add r0,r1 + jsr @r1 + add r12,r4 + bra 3f + nop + .align 2 +1: .long bar@TLSLDM +2: .long __tls_get_addr@PLT +3: + ! Just show that there can be arbitrary instructions here + mov #1,r2 + + mov.l .L4,r1 + add r1,r0 + ! r0 now contains &bar + + ! Again, arbitrary instructions + mov.l r2,@r0 + + mov.l .L5,r1 + add r1,r0 + ! r0 now contains &baz + + mov r14,r15 + lds.l @r15+,pr + mov.l @r15+,r14 + rts + mov.l @r15+,r12 + + .align 2 +.L3: .long _GLOBAL_OFFSET_TABLE_ +.L4: .long bar@DTPOFF +.L5: .long baz@DTPOFF diff --git a/gas/testsuite/gas/sh/tlsnopic.d b/gas/testsuite/gas/sh/tlsnopic.d new file mode 100644 index 00000000000..c987939c41c --- /dev/null +++ b/gas/testsuite/gas/sh/tlsnopic.d @@ -0,0 +1,20 @@ +#objdump: -dr +#as: -big +#name: sh non-pic tls + +.*: +file format .* + +Disassembly of section .text: + +0+000 : + 0: 2f e6 [ ]*mov\.l r14,@-r15 + 2: 6e f3 [ ]*mov r15,r14 + 4: 01 12 [ ]*stc gbr,r1 + 6: d0 02 [ ]*mov\.l 10 ,r0[ ]+! 0x0 + 8: 30 1c [ ]*add r1,r0 + a: 6f e3 [ ]*mov r14,r15 + c: 00 0b [ ]*rts + e: 6e f6 [ ]*mov\.l @r15\+,r14 + 10: 00 00 [ ]*\.word 0x0+0 +[ ]+10: R_SH_TLS_LE_32 foo + \.\.\. diff --git a/gas/testsuite/gas/sh/tlsnopic.s b/gas/testsuite/gas/sh/tlsnopic.s new file mode 100644 index 00000000000..8f4d00b8e75 --- /dev/null +++ b/gas/testsuite/gas/sh/tlsnopic.s @@ -0,0 +1,23 @@ + .section .tbss,"awT",@nobits + .align 2 + .long foo + .text + .align 1 + .global fn + .type fn, @function +fn: + ! Main binary, no PIC + mov.l r14,@-r15 + mov r15,r14 + + stc gbr,r1 + mov.l .L2,r0 + add r1,r0 + ! r0 now contains &foo + + mov r14,r15 + rts + mov.l @r15+,r14 +.L3: + .align 2 +.L2: .long foo@TPOFF diff --git a/gas/testsuite/gas/sh/tlspic.d b/gas/testsuite/gas/sh/tlspic.d new file mode 100644 index 00000000000..b15e0631854 --- /dev/null +++ b/gas/testsuite/gas/sh/tlspic.d @@ -0,0 +1,33 @@ +#objdump: -dr +#as: -big +#name: sh pic tls + +.*: +file format .* + +Disassembly of section .text: + +0+000 : + 0: 2f c6 [ ]*mov\.l r12,@-r15 + 2: 2f e6 [ ]*mov\.l r14,@-r15 + 4: 6e f3 [ ]*mov r15,r14 + 6: c7 08 [ ]*mova 28 ,r0 + 8: dc 07 [ ]*mov\.l 28 ,r12[ ]+! 0x0 + a: 3c 0c [ ]*add r0,r12 + c: d0 02 [ ]*mov\.l 18 ,r0[ ]+! 0x0 + e: 01 12 [ ]*stc gbr,r1 + 10: 00 ce [ ]*mov\.l @\(r0,r12\),r0 + 12: a0 03 [ ]*bra 1c + 14: 31 0c [ ]*add r0,r1 + 16: 00 09 [ ]*nop + 18: 00 00 [ ]*\.word 0x0000 +[ ]+18: R_SH_TLS_IE_32 foo + 1a: 00 00 [ ]*\.word 0x0000 + 1c: 60 13 [ ]*mov r1,r0 + 1e: 6f e3 [ ]*mov r14,r15 + 20: 6e f6 [ ]*mov\.l @r15\+,r14 + 22: 00 0b [ ]*rts + 24: 6c f6 [ ]*mov\.l @r15\+,r12 + 26: 00 09 [ ]*nop + 28: 00 00 [ ]*\.word 0x0+0 +[ ]+28: R_SH_GOTPC _GLOBAL_OFFSET_TABLE_ + \.\.\. diff --git a/gas/testsuite/gas/sh/tlspic.s b/gas/testsuite/gas/sh/tlspic.s new file mode 100644 index 00000000000..359530236be --- /dev/null +++ b/gas/testsuite/gas/sh/tlspic.s @@ -0,0 +1,30 @@ + .text + .align 1 + .global fn + .type fn, @function +fn: + ! Main binary, PIC + mov.l r12,@-r15 + mov.l r14,@-r15 + mov r15,r14 + mova .L3,r0 + mov.l .L3,r12 + add r0,r12 + + mov.l 1f,r0 + stc gbr,r1 + mov.l @(r0,r12),r0 + bra 2f + add r0,r1 + .align 2 +1: .long foo@GOTTPOFF +2: ! now r1 contains &foo + + mov r1,r0 + mov r14,r15 + mov.l @r15+,r14 + rts + mov.l @r15+,r12 + + .align 2 +.L3: .long _GLOBAL_OFFSET_TABLE_ -- 2.30.2