* 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.
This commit is contained in:
Kaz Kojima 2002-10-11 14:42:51 +00:00
parent 041bed02bf
commit 94a03f18b8
8 changed files with 246 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2002-10-11 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* 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 <stephen.clarke@superh.com>
* gas/elf.exp: Don't run for sh64*-*-linux*, because it sets the

View File

@ -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"
}
}

View File

@ -0,0 +1,55 @@
#objdump: -dr
#as: -big
#name: sh dynamic tls
.*: +file format .*
Disassembly of section .text:
0+000 <fn>:
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 <fn\+0x58>,r0
8: dc 13 [ ]*mov\.l 58 <fn\+0x58>,r12[ ]+! 0x0
a: 3c 0c [ ]*add r0,r12
c: 6e f3 [ ]*mov r15,r14
e: d4 04 [ ]*mov\.l 20 <fn\+0x20>,r4[ ]+! 0x0
10: c7 04 [ ]*mova 24 <fn\+0x24>,r0
12: d1 04 [ ]*mov\.l 24 <fn\+0x24>,r1[ ]+! 0x0
14: 31 0c [ ]*add r0,r1
16: 41 0b [ ]*jsr @r1
18: 34 cc [ ]*add r12,r4
1a: a0 05 [ ]*bra 28 <fn\+0x28>
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 <fn\+0x38>,r4[ ]+! 0x0
2a: c7 04 [ ]*mova 3c <fn\+0x3c>,r0
2c: d1 03 [ ]*mov\.l 3c <fn\+0x3c>,r1[ ]+! 0x0
2e: 31 0c [ ]*add r0,r1
30: 41 0b [ ]*jsr @r1
32: 34 cc [ ]*add r12,r4
34: a0 04 [ ]*bra 40 <fn\+0x40>
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 <fn\+0x5c>,r1[ ]+! 0x0
44: 30 1c [ ]*add r1,r0
46: 20 22 [ ]*mov\.l r2,@r0
48: d1 05 [ ]*mov\.l 60 <fn\+0x60>,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

View File

@ -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

View File

@ -0,0 +1,20 @@
#objdump: -dr
#as: -big
#name: sh non-pic tls
.*: +file format .*
Disassembly of section .text:
0+000 <fn>:
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 <fn\+0x10>,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
\.\.\.

View File

@ -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

View File

@ -0,0 +1,33 @@
#objdump: -dr
#as: -big
#name: sh pic tls
.*: +file format .*
Disassembly of section .text:
0+000 <fn>:
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 <fn\+0x28>,r0
8: dc 07 [ ]*mov\.l 28 <fn\+0x28>,r12[ ]+! 0x0
a: 3c 0c [ ]*add r0,r12
c: d0 02 [ ]*mov\.l 18 <fn\+0x18>,r0[ ]+! 0x0
e: 01 12 [ ]*stc gbr,r1
10: 00 ce [ ]*mov\.l @\(r0,r12\),r0
12: a0 03 [ ]*bra 1c <fn\+0x1c>
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_
\.\.\.

View File

@ -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_