diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2003-02-02 19:37:20 +0000 |
---|---|---|
committer | Richard Sandiford <rdsandiford@googlemail.com> | 2003-02-02 19:37:20 +0000 |
commit | 5e0116d519c197dbd989e07c5e011e7a0dfd73c7 (patch) | |
tree | 26d7d8895bd7d0340a4d334d2598a6326243ccd4 /gas/testsuite | |
parent | 5f601589e1e0dad6276d458d25c818ff6458b3f3 (diff) | |
download | binutils-5e0116d519c197dbd989e07c5e011e7a0dfd73c7.zip binutils-5e0116d519c197dbd989e07c5e011e7a0dfd73c7.tar.gz binutils-5e0116d519c197dbd989e07c5e011e7a0dfd73c7.tar.bz2 |
gas/
* config/tc-mips.c (enum small_ex_type): Remove.
(imm_unmatched_hi): Remove.
(md_assemble): Remove use of imm_unmatched_hi. Remove the last
argument from calls to append_insn.
(append_insn): Remove unmatched_hi parameter; check reloc_type[0]
instead.
(macro_build): Update append_insn calls.
(mips16_macro_build, macro_build_lui): Likewise.
(mips_ip): Rework handling of small expressions. Move explicit
relocation handling into my_getSmallExpression. Assume that the
value of 'o' operands is zero if there is only one bracketed
expression left.
(percent_op): Make constant. Record the BFD relocation code
associated with each operator.
(my_getSmallParser, my_getPercentOp): Remove.
(parse_relocation): New function.
(my_getSamllExpression): Rework. Fill in relocations here
rather than in mips_ip.
gas/testsuite
* gas/mips/elf-rel8.[sd], gas/mips/elf-rel9.[sd],
gas/mips/elf-rel10.[sd], gas/mips/elf-rel11.[sd]: New tests.
* gas/mips/mips.exp: Run elf-rel8 and elf-rel9 for all elf
targets. Run elf-rel10 and elf-rel11 for NewABI targets.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/elf-rel10.d | 29 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/elf-rel10.s | 31 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/elf-rel11.d | 43 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/elf-rel11.s | 27 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/elf-rel8.d | 57 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/elf-rel8.s | 53 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/elf-rel9.d | 68 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/elf-rel9.s | 57 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/mips.exp | 10 |
10 files changed, 380 insertions, 2 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index d4dacdf..7729161 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2003-02-02 Richard Sandiford <rsandifo@redhat.com> + + * gas/mips/elf-rel8.[sd], gas/mips/elf-rel9.[sd], + gas/mips/elf-rel10.[sd], gas/mips/elf-rel11.[sd]: New tests. + * gas/mips/mips.exp: Run elf-rel8 and elf-rel9 for all elf + targets. Run elf-rel10 and elf-rel11 for NewABI targets. + 2003-01-27 Alexandre Oliva <aoliva@redhat.com> * gas/mips/n32-consec.d: New. diff --git a/gas/testsuite/gas/mips/elf-rel10.d b/gas/testsuite/gas/mips/elf-rel10.d new file mode 100644 index 0000000..eb12f13 --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel10.d @@ -0,0 +1,29 @@ +#as: -march=mips3 -mabi=n32 -KPIC +#readelf: --relocs +#name: MIPS ELF reloc 10 + +Relocation section '\.rela\.text' at offset .* contains 22 entries: + *Offset * Info * Type * Sym\.Value * Sym\. Name \+ Addend +0+0000 * 0+..07 * R_MIPS_GPREL16 * 0+0000 * foo \+ 0 +0+0000 * 0+0018 * R_MIPS_SUB * 0+0000 +0+0000 * 0+0005 * R_MIPS_HI16 * 0+0000 +0+0004 * 0+..07 * R_MIPS_GPREL16 * 0+0000 * foo \+ 0 +0+0004 * 0+0018 * R_MIPS_SUB * 0+0000 +0+0004 * 0+0006 * R_MIPS_LO16 * 0+0000 +0+000c * 0+..07 * R_MIPS_GPREL16 * 0+0000 * \.text \+ c +0+000c * 0+0018 * R_MIPS_SUB * 0+0000 +0+000c * 0+0005 * R_MIPS_HI16 * 0+0000 +0+0010 * 0+..07 * R_MIPS_GPREL16 * 0+0000 * \.text \+ c +0+0010 * 0+0018 * R_MIPS_SUB * 0+0000 +0+0010 * 0+0006 * R_MIPS_LO16 * 0+0000 +0+0018 * 0+..14 * R_MIPS_GOT_PAGE * 0+0000 * foo \+ 0 +0+001c * 0+..15 * R_MIPS_GOT_OFST * 0+0000 * foo \+ 0 +0+0020 * 0+..14 * R_MIPS_GOT_PAGE * 0+0000 * foo \+ 1234 +0+0024 * 0+..15 * R_MIPS_GOT_OFST * 0+0000 * foo \+ 1234 +0+0028 * 0+..14 * R_MIPS_GOT_PAGE * 0+0000 * \.text \+ c +0+002c * 0+..15 * R_MIPS_GOT_OFST * 0+0000 * \.text \+ c +0+0030 * 0+..14 * R_MIPS_GOT_PAGE * 0+0000 * \.text \+ 33221d +0+0034 * 0+..15 * R_MIPS_GOT_OFST * 0+0000 * \.text \+ 33221d +0+0038 * 0+..14 * R_MIPS_GOT_PAGE * 0+0000 * frob \+ 0 +0+003c * 0+..15 * R_MIPS_GOT_OFST * 0+0000 * frob \+ 0 +#pass diff --git a/gas/testsuite/gas/mips/elf-rel10.s b/gas/testsuite/gas/mips/elf-rel10.s new file mode 100644 index 0000000..cda73de --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel10.s @@ -0,0 +1,31 @@ + .globl foo + .ent foo +foo: + lui $gp,%hi(%neg(%gp_rel(foo))) + addiu $gp,$gp,%lo(%neg(%gp_rel(foo))) + daddu $gp,$gp,$25 + .end foo + + .ent bar +bar: + lui $gp,%hi(%neg(%gp_rel(bar))) + addiu $gp,$gp,%lo(%neg(%gp_rel(bar))) + daddu $gp,$gp,$25 + .end bar + + .ent frob + lw $4,%got_page(foo)($gp) + addiu $4,$4,%got_ofst(foo) + + lw $4,%got_page(foo + 0x1234)($gp) + addiu $4,$4,%got_ofst(foo + 0x1234) + + lw $4,%got_page(bar)($gp) + addiu $4,$4,%got_ofst(bar) + + lw $4,%got_page(bar + 0x332211)($gp) + addiu $4,$4,%got_ofst(bar + 0x332211) + + lw $4,%got_page(frob)($gp) + addiu $4,$4,%got_ofst(frob) + .end frob diff --git a/gas/testsuite/gas/mips/elf-rel11.d b/gas/testsuite/gas/mips/elf-rel11.d new file mode 100644 index 0000000..408795d --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel11.d @@ -0,0 +1,43 @@ +#as: -march=mips3 -mabi=64 +#readelf: --relocs +#name: MIPS ELF reloc 11 + +Relocation section '\.rela\.text' at offset .* contains 12 entries: + *Offset * Info * Type * Sym\. Value * Sym\. Name \+ Addend +0+0000 * 0+..0000001d * R_MIPS_HIGHEST * 0+0000 * bar \+ 0 + * Type2: R_MIPS_NONE * + * Type3: R_MIPS_NONE * +0+0008 * 0+..0000001c * R_MIPS_HIGHER * 0+0000 * bar \+ 0 + * Type2: R_MIPS_NONE * + * Type3: R_MIPS_NONE * +0+0004 * 0+..00000005 * R_MIPS_HI16 * 0+0000 * bar \+ 0 + * Type2: R_MIPS_NONE * + * Type3: R_MIPS_NONE * +0+000c * 0+..00000006 * R_MIPS_LO16 * 0+0000 * bar \+ 0 + * Type2: R_MIPS_NONE * + * Type3: R_MIPS_NONE * +0+0018 * 0+..0000001d * R_MIPS_HIGHEST * 0+0000 * bar \+ 12345678 + * Type2: R_MIPS_NONE * + * Type3: R_MIPS_NONE * +0+0020 * 0+..0000001c * R_MIPS_HIGHER * 0+0000 * bar \+ 12345678 + * Type2: R_MIPS_NONE * + * Type3: R_MIPS_NONE * +0+001c * 0+..00000005 * R_MIPS_HI16 * 0+0000 * bar \+ 12345678 + * Type2: R_MIPS_NONE * + * Type3: R_MIPS_NONE * +0+0024 * 0+..00000006 * R_MIPS_LO16 * 0+0000 * bar \+ 12345678 + * Type2: R_MIPS_NONE * + * Type3: R_MIPS_NONE * +0+0030 * 0+..0000001d * R_MIPS_HIGHEST * 0+0000 * \.data \+ 10 + * Type2: R_MIPS_NONE * + * Type3: R_MIPS_NONE * +0+0034 * 0+..0000001c * R_MIPS_HIGHER * 0+0000 * \.data \+ 10 + * Type2: R_MIPS_NONE * + * Type3: R_MIPS_NONE * +0+003c * 0+..00000005 * R_MIPS_HI16 * 0+0000 * \.data \+ 10 + * Type2: R_MIPS_NONE * + * Type3: R_MIPS_NONE * +0+0044 * 0+..00000006 * R_MIPS_LO16 * 0+0000 * \.data \+ 10 + * Type2: R_MIPS_NONE * + * Type3: R_MIPS_NONE * +#pass diff --git a/gas/testsuite/gas/mips/elf-rel11.s b/gas/testsuite/gas/mips/elf-rel11.s new file mode 100644 index 0000000..e8f5378 --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel11.s @@ -0,0 +1,27 @@ + .ent foo +foo: + lui $4,%highest(bar) + lui $5,%hi(bar) + daddiu $4,$4,%higher(bar) + daddiu $5,$5,%lo(bar) + dsll32 $4,$4,0 + daddu $4,$4,$5 + + lui $4,%highest(bar + 0x12345678) + lui $5,%hi(bar + 0x12345678) + daddiu $4,$4,%higher(bar + 0x12345678) + daddiu $5,$5,%lo(bar + 0x12345678) + dsll32 $4,$4,0 + daddu $4,$4,$5 + + lui $4,%highest(l1) + daddiu $4,$4,%higher(l1) + dsll $4,$4,16 + daddiu $4,$4,%hi(l1) + dsll $4,$4,16 + lw $4,%lo(l1)($4) + .end foo + + .data + .word 1,2,3,4 +l1: .word 4,5 diff --git a/gas/testsuite/gas/mips/elf-rel8.d b/gas/testsuite/gas/mips/elf-rel8.d new file mode 100644 index 0000000..270533b --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel8.d @@ -0,0 +1,57 @@ +#as: -march=mips2 -mabi=32 +#objdump: -M gpr-names=numeric -dr +#name: MIPS ELF reloc 8 + +.*: file format .* + +Disassembly of section \.text: + +0+00 <foo>: + 0: 3c040000 lui \$4,0x0 + 0: R_MIPS_HI16 gvar + 4: 24840000 addiu \$4,\$4,0 + 4: R_MIPS_LO16 gvar + 8: 8ca40000 lw \$4,0\(\$5\) + 8: R_MIPS_LO16 gvar + c: 8fc40002 lw \$4,2\(\$30\) + 10: 3c040000 lui \$4,0x0 + 10: R_MIPS_CALL_HI16 gfunc + 14: 009c2021 addu \$4,\$4,\$28 + 18: 8c990000 lw \$25,0\(\$4\) + 18: R_MIPS_CALL_LO16 gfunc + 1c: 3c040000 lui \$4,0x0 + 1c: R_MIPS_GOT_HI16 gvar + 20: 009c2021 addu \$4,\$4,\$28 + 24: 8c850000 lw \$5,0\(\$4\) + 24: R_MIPS_GOT_LO16 gvar + 28: 8f840000 lw \$4,0\(\$28\) + 28: R_MIPS_GOT16 \.data + 2c: a0850000 sb \$5,0\(\$4\) + 2c: R_MIPS_LO16 \.data + 30: 3c040000 lui \$4,0x0 + 30: R_MIPS_CALL_HI16 gfunc + 34: 24840000 addiu \$4,\$4,0 + 34: R_MIPS_CALL_LO16 gfunc + 38: 3c040000 lui \$4,0x0 + 38: R_MIPS_GOT_HI16 gvar + 3c: 24840000 addiu \$4,\$4,0 + 3c: R_MIPS_GOT_LO16 gvar + 40: 8f840000 lw \$4,0\(\$28\) + 40: R_MIPS_GOT16 \.data + 44: 24840000 addiu \$4,\$4,0 + 44: R_MIPS_LO16 \.data + 48: 8f990000 lw \$25,0\(\$28\) + 48: R_MIPS_CALL16 gfunc + 4c: 27840000 addiu \$4,\$28,0 + 4c: R_MIPS_CALL16 gfunc + 50: 8f840000 lw \$4,0\(\$28\) + 50: R_MIPS_GOT_DISP gvar + 54: 27840000 addiu \$4,\$28,0 + 54: R_MIPS_GOT_DISP gvar + 58: 8f840000 lw \$4,0\(\$28\) + 58: R_MIPS_GPREL16 gvar + 5c: af840000 sw \$4,0\(\$28\) + 5c: R_MIPS_GPREL16 gvar + 60: 27840000 addiu \$4,\$28,0 + 60: R_MIPS_GPREL16 gvar + \.\.\. diff --git a/gas/testsuite/gas/mips/elf-rel8.s b/gas/testsuite/gas/mips/elf-rel8.s new file mode 100644 index 0000000..b3f5dab --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel8.s @@ -0,0 +1,53 @@ + .equ $fprel, 2 + + .ent foo +foo: + # Test various forms of relocation syntax. + + lui $4,(%hi gvar) + addiu $4,$4,(%lo (gvar)) + lw $4,%lo gvar($5) + + # Check that registers aren't confused with $ identifiers. + + lw $4,($fprel)($fp) + + # Check various forms of paired relocations. + + lui $4,%call_hi(gfunc) + addu $4,$4,$gp + lw $25,%call_lo(gfunc)($4) + + lui $4,%got_hi(gvar) + addu $4,$4,$gp + lw $5,%got_lo(gvar)($4) + + lw $4,%got(lvar)($28) + sb $5,%lo(lvar)($4) + + lui $4,%call_hi(gfunc) + addiu $4,$4,%call_lo(gfunc) + + lui $4,%got_hi(gvar) + addiu $4,$4,%got_lo(gvar) + + lw $4,%got(lvar)($28) + addiu $4,$4,%lo(lvar) + + # Check individual relocations. + + lw $25,%call16(gfunc)($28) + addiu $4,$28,%call16(gfunc) + + lw $4,%got_disp(gvar)($28) + addiu $4,$28,%got_disp(gvar) + + lw $4,%gp_rel(gvar)($28) + sw $4,%gp_rel(gvar)($28) + addiu $4,$28,%gp_rel(gvar) + + .space 64 + .end foo + + .data +lvar: .word 1,2 diff --git a/gas/testsuite/gas/mips/elf-rel9.d b/gas/testsuite/gas/mips/elf-rel9.d new file mode 100644 index 0000000..c78a4bf --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel9.d @@ -0,0 +1,68 @@ +#as: -march=mips2 -mabi=32 +#objdump: -M gpr-names=numeric -dr +#name: MIPS ELF reloc 9 + +.*: file format .* + +Disassembly of section \.text: + +0+00 <foo>: + 0: 8f840000 lw \$4,0\(\$28\) + 0: R_MIPS_GOT16 \.data + 4: 24840010 addiu \$4,\$4,16 + 4: R_MIPS_LO16 \.data + 8: 8f840000 lw \$4,0\(\$28\) + 8: R_MIPS_GOT16 \.data + c: 24840020 addiu \$4,\$4,32 + c: R_MIPS_LO16 \.data + 10: 8f840000 lw \$4,0\(\$28\) + 10: R_MIPS_GOT16 \.data + 14: 24847ffc addiu \$4,\$4,32764 + 14: R_MIPS_LO16 \.data + 18: 8f840001 lw \$4,1\(\$28\) + 18: R_MIPS_GOT16 \.data + 1c: 24848000 addiu \$4,\$4,-32768 + 1c: R_MIPS_LO16 \.data + 20: 8f840001 lw \$4,1\(\$28\) + 20: R_MIPS_GOT16 \.data + 24: 2484fffc addiu \$4,\$4,-4 + 24: R_MIPS_LO16 \.data + 28: 8f840001 lw \$4,1\(\$28\) + 28: R_MIPS_GOT16 \.data + 2c: 24840000 addiu \$4,\$4,0 + 2c: R_MIPS_LO16 \.data + 30: 8f840002 lw \$4,2\(\$28\) + 30: R_MIPS_GOT16 \.data + 34: 24848010 addiu \$4,\$4,-32752 + 34: R_MIPS_LO16 \.data + 38: 8f840002 lw \$4,2\(\$28\) + 38: R_MIPS_GOT16 \.data + 3c: 2484f000 addiu \$4,\$4,-4096 + 3c: R_MIPS_LO16 \.data + 40: 8f840002 lw \$4,2\(\$28\) + 40: R_MIPS_GOT16 \.data + 44: 2484ffff addiu \$4,\$4,-1 + 44: R_MIPS_LO16 \.data + 48: 8f840002 lw \$4,2\(\$28\) + 48: R_MIPS_GOT16 \.data + 4c: 2484f100 addiu \$4,\$4,-3840 + 4c: R_MIPS_LO16 \.data + 50: 8f840003 lw \$4,3\(\$28\) + 50: R_MIPS_GOT16 \.data + 54: 24841345 addiu \$4,\$4,4933 + 54: R_MIPS_LO16 \.data + 58: 8f84c000 lw \$4,-16384\(\$28\) + 58: R_MIPS_GPREL16 \.sdata\+0x4000 + 5c: 8f84c004 lw \$4,-16380\(\$28\) + 5c: R_MIPS_GPREL16 \.sdata\+0x4000 + 60: 8f84c004 lw \$4,-16380\(\$28\) + 60: R_MIPS_GPREL16 \.sdata\+0x4000 + 64: 8f84c008 lw \$4,-16376\(\$28\) + 64: R_MIPS_GPREL16 \.sdata\+0x4000 + 68: 8f84c00c lw \$4,-16372\(\$28\) + 68: R_MIPS_GPREL16 \.sdata\+0x4000 + 6c: 8f84c014 lw \$4,-16364\(\$28\) + 6c: R_MIPS_GPREL16 \.sdata\+0x4000 + 70: 8f84c018 lw \$4,-16360\(\$28\) + 70: R_MIPS_GPREL16 \.sdata\+0x4000 + \.\.\. diff --git a/gas/testsuite/gas/mips/elf-rel9.s b/gas/testsuite/gas/mips/elf-rel9.s new file mode 100644 index 0000000..4768c24 --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel9.s @@ -0,0 +1,57 @@ + .ent foo +foo: + lw $4,%got(l1)($28) + addiu $4,$4,%lo(l1) + + lw $4,%got(l1 + 16)($28) + addiu $4,$4,%lo(l1 + 16) + + lw $4,%got(l1 + 0x7fec)($28) + addiu $4,$4,%lo(l1 + 0x7fec) + + lw $4,%got(l1 + 0x7ff0)($28) + addiu $4,$4,%lo(l1 + 0x7ff0) + + lw $4,%got(l1 + 0xffec)($28) + addiu $4,$4,%lo(l1 + 0xffec) + + lw $4,%got(l1 + 0xfff0)($28) + addiu $4,$4,%lo(l1 + 0xfff0) + + lw $4,%got(l1 + 0x18000)($28) + addiu $4,$4,%lo(l1 + 0x18000) + + lw $4,%got(l2)($28) + addiu $4,$4,%lo(l2) + + lw $4,%got(l2 + 0xfff)($28) + addiu $4,$4,%lo(l2 + 0xfff) + + lw $4,%got(l2 + 0x1000)($28) + addiu $4,$4,%lo(l2 + 0x100) + + lw $4,%got(l2 + 0x12345)($28) + addiu $4,$4,%lo(l2 + 0x12345) + + lw $4,%gp_rel(l3)($28) + lw $4,%gp_rel(l3 + 4)($28) + lw $4,%gp_rel(l4)($28) + lw $4,%gp_rel(l4 + 4)($28) + lw $4,%gp_rel(l5)($28) + lw $4,%gp_rel(l5 + 8)($28) + lw $4,%gp_rel(l5 + 12)($28) + + .space 64 + .end foo + + .data + .word 1,2,3,4 +l1: .word 4,5 + .space 0x1f000 - 24 +l2: .word 7,8 + + .sdata +l3: .word 1 +l4: .word 2 + .word 3 +l5: .word 4 diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 046a33f..43b2193 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -376,7 +376,7 @@ if { [istarget mips*-*-*] } then { set ilocks [istarget mipstx39*-*-*] set gpr_ilocks [expr [istarget mipstx39*-*-*]] set addr32 [expr [istarget mipstx39*-*-*]] - set hasn32 [expr [istarget *-*-irix6*] || [istarget mips64*-*-linux*]] + set has_newabi [expr [istarget *-*-irix6*] || [istarget mips64*-*-linux*]] if { [istarget "mips*-*-*linux*"] } then { set tmips "t" @@ -602,6 +602,12 @@ if { [istarget mips*-*-*] } then { run_dump_test "elf-rel5" run_dump_test "elf-rel6" run_dump_test "elf-rel7" + run_dump_test "elf-rel8" + run_dump_test "elf-rel9" + if $has_newabi { + run_dump_test "elf-rel10" + run_dump_test "elf-rel11" + } run_dump_test "${tmips}${el}empic" run_dump_test "empic2" run_dump_test "empic3_e" @@ -614,7 +620,7 @@ if { [istarget mips*-*-*] } then { run_dump_test "elf-consthilo" } - if $hasn32 { + if $has_newabi { run_dump_test "n32-consec" } |