diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index dc0c3efab3..58d3a3a5d4 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2005-03-02 Daniel Jacobowitz + + * gas/mips/tls-o32.d, gas/mips/tls-o32.s, gas/mips/tls-ill.l, + gas/mips/tls-ill.s: New files. + * gas/mips/mips.exp: Run TLS tests. + 2005-03-02 Alan Modra * gas/ppc/astest.d: Adjust for relocs reduced to section sym. diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index a64d8b4551..b1772a3083 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -336,6 +336,11 @@ proc run_list_test_arches { name opts arch_list } { foreach arch $arch_list { run_list_test_arch "$name" "$opts" "$arch" } + + if $elf { + run_list_test "tls-ill" "-32" + run_dump_test "tls-o32" + } } diff --git a/gas/testsuite/gas/mips/tls-ill.l b/gas/testsuite/gas/mips/tls-ill.l new file mode 100644 index 0000000000..1c1e73cead --- /dev/null +++ b/gas/testsuite/gas/mips/tls-ill.l @@ -0,0 +1,11 @@ +.*: Assembler messages: +.*:6: Error: bad expression +.*:6: Error: illegal operands `addiu' +.*:7: Error: bad expression +.*:7: Error: illegal operands `addiu' +.*:8: Error: bad expression +.*:8: Error: missing '\)' +.*:8: Error: illegal operands `addiu' +.*:9: Error: bad expression +.*:9: Error: missing '\)' +.*:9: Error: illegal operands `addiu' diff --git a/gas/testsuite/gas/mips/tls-ill.s b/gas/testsuite/gas/mips/tls-ill.s new file mode 100644 index 0000000000..1632984a20 --- /dev/null +++ b/gas/testsuite/gas/mips/tls-ill.s @@ -0,0 +1,9 @@ + .abicalls + .text + + /* These have obvious meanings, but we don't have currently defined + relocations for them. */ + addiu $4,$28,%dtprel(tlsvar) + addiu $4,$28,%tprel(tlsvar) + addiu $4,$28,%lo(%gottprel(tlsvar)) + addiu $4,$28,%hi(%gottprel(tlsvar)) diff --git a/gas/testsuite/gas/mips/tls-o32.d b/gas/testsuite/gas/mips/tls-o32.d new file mode 100644 index 0000000000..feb58ae610 --- /dev/null +++ b/gas/testsuite/gas/mips/tls-o32.d @@ -0,0 +1,55 @@ +#as: -EB -march=mips1 -mabi=32 +#objdump: -dr +#name: MIPS ELF TLS o32 + +dump.o: file format elf32-.*bigmips + +Disassembly of section .text: + +00000000 : + 0: 3c1c0000 lui gp,0x0 + 0: R_MIPS_HI16 _gp_disp + 4: 279c0000 addiu gp,gp,0 + 4: R_MIPS_LO16 _gp_disp + 8: 0399e021 addu gp,gp,t9 + c: 27bdfff0 addiu sp,sp,-16 + 10: afbe0008 sw s8,8\(sp\) + 14: 03a0f021 move s8,sp + 18: afbc0000 sw gp,0\(sp\) + 1c: 8f990000 lw t9,0\(gp\) + 1c: R_MIPS_CALL16 __tls_get_addr + 20: 27840000 addiu a0,gp,0 + 20: R_MIPS_TLS_GD tlsvar_gd + 24: 0320f809 jalr t9 + 28: 00000000 nop + 2c: 8fdc0000 lw gp,0\(s8\) + 30: 00000000 nop + 34: 8f990000 lw t9,0\(gp\) + 34: R_MIPS_CALL16 __tls_get_addr + 38: 27840000 addiu a0,gp,0 + 38: R_MIPS_TLS_LDM tlsvar_ld + 3c: 0320f809 jalr t9 + 40: 00000000 nop + 44: 8fdc0000 lw gp,0\(s8\) + 48: 00401021 move v0,v0 + 4c: 3c030000 lui v1,0x0 + 4c: R_MIPS_TLS_DTPREL_HI16 tlsvar_ld + 50: 24630000 addiu v1,v1,0 + 50: R_MIPS_TLS_DTPREL_LO16 tlsvar_ld + 54: 00621821 addu v1,v1,v0 + 58: 7c02283b 0x7c02283b + 5c: 8f830000 lw v1,0\(gp\) + 5c: R_MIPS_TLS_GOTTPREL tlsvar_ie + 60: 00000000 nop + 64: 00621821 addu v1,v1,v0 + 68: 7c02283b 0x7c02283b + 6c: 3c030000 lui v1,0x0 + 6c: R_MIPS_TLS_TPREL_HI16 tlsvar_le + 70: 34630000 ori v1,v1,0x0 + 70: R_MIPS_TLS_TPREL_LO16 tlsvar_le + 74: 00621821 addu v1,v1,v0 + 78: 03c0e821 move sp,s8 + 7c: 8fbe0008 lw s8,8\(sp\) + 80: 03e00008 jr ra + 84: 27bd0010 addiu sp,sp,16 +#pass diff --git a/gas/testsuite/gas/mips/tls-o32.s b/gas/testsuite/gas/mips/tls-o32.s new file mode 100644 index 0000000000..a4c3e379dc --- /dev/null +++ b/gas/testsuite/gas/mips/tls-o32.s @@ -0,0 +1,85 @@ + .file 1 "tls.s" + .abicalls + .text + .align 2 + .globl fn + .ent fn + .type fn,@function +fn: + .frame $fp,16,$31 + .mask 0x40000000,-8 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-16 + sw $fp,8($sp) + move $fp,$sp + .cprestore 0 + + # General Dynamic + lw $25,%call16(__tls_get_addr)($28) + addiu $4,$28,%tlsgd(tlsvar_gd) + jal $25 + + # Local Dynamic + lw $25,%call16(__tls_get_addr)($28) + addiu $4,$28,%tlsldm(tlsvar_ld) + jal $25 + + move $2,$2 # Arbitrary instructions + + lui $3,%dtprel_hi(tlsvar_ld) + addiu $3,$3,%dtprel_lo(tlsvar_ld) + addu $3,$3,$2 + + # Initial Exec + .set push + .set mips32r2 + rdhwr $2, $5 + .set pop + lw $3,%gottprel(tlsvar_ie)($28) + addu $3,$3,$2 + + # Local Exec + .set push + .set mips32r2 + rdhwr $2, $5 + .set pop + lui $3,%tprel_hi(tlsvar_le) + ori $3,$3,%tprel_lo(tlsvar_le) + addu $3,$3,$2 + + move $sp,$fp + lw $fp,8($sp) + addiu $sp,$sp,16 + j $31 + .end fn + + .section .tbss,"awT",@nobits + .align 2 + .global tlsvar_gd + .type tlsvar_gd,@object + .size tlsvar_gd,4 +tlsvar_gd: + .space 4 + .global tlsvar_ie + .type tlsvar_ie,@object + .size tlsvar_ie,4 +tlsvar_ie: + .space 4 + + .section .tdata,"awT" + .align 2 + .global tlsvar_ld + .hidden tlsvar_ld + .type tlsvar_ld,@object + .size tlsvar_ld,4 +tlsvar_ld: + .word 1 + .global tlsvar_le + .hidden tlsvar_le + .type tlsvar_le,@object + .size tlsvar_le,4 +tlsvar_le: + .word 1