From e391c02431f9d5973f685981cfaf1edfb0970cdb Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sat, 13 Nov 2010 11:59:21 +0000 Subject: [PATCH] gas/ * config/tc-mips.c (macro_build): Remove gas_assert from 'o' case. Use a restricted gas_assert for 'i' and 'j'. gas/testsuite/ * gas/mips/elf-rel28.s, gas/mips/elf-rel28-n32.d, gas/mips/elf-rel28-n64.d: New test. * gas/mips/mips.exp: Run it. --- gas/ChangeLog | 5 + gas/config/tc-mips.c | 23 ++--- gas/testsuite/ChangeLog | 6 ++ gas/testsuite/gas/mips/elf-rel28-n32.d | 96 ++++++++++++++++++ gas/testsuite/gas/mips/elf-rel28-n64.d | 180 +++++++++++++++++++++++++++++++++ gas/testsuite/gas/mips/elf-rel28.s | 48 +++++++++ gas/testsuite/gas/mips/mips.exp | 5 + 7 files changed, 351 insertions(+), 12 deletions(-) create mode 100644 gas/testsuite/gas/mips/elf-rel28-n32.d create mode 100644 gas/testsuite/gas/mips/elf-rel28-n64.d create mode 100644 gas/testsuite/gas/mips/elf-rel28.s diff --git a/gas/ChangeLog b/gas/ChangeLog index 732a726..784d84d 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2010-11-13 Richard Sandiford + + * config/tc-mips.c (macro_build): Remove gas_assert from 'o' case. + Use a restricted gas_assert for 'i' and 'j'. + 2010-11-11 Mingming Sun * config/tc-mips.c (mips_cpu_info_table): Add loongson3a in MIPS 64. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index ddeb513..77397bb 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -3765,20 +3765,16 @@ macro_build (expressionS *ep, const char *name, const char *fmt, ...) case 'i': case 'j': - case 'o': macro_read_relocs (&args, r); gas_assert (*r == BFD_RELOC_GPREL16 - || *r == BFD_RELOC_MIPS_LITERAL - || *r == BFD_RELOC_MIPS_HIGHER - || *r == BFD_RELOC_HI16_S - || *r == BFD_RELOC_LO16 - || *r == BFD_RELOC_MIPS_GOT16 - || *r == BFD_RELOC_MIPS_CALL16 - || *r == BFD_RELOC_MIPS_GOT_DISP - || *r == BFD_RELOC_MIPS_GOT_PAGE - || *r == BFD_RELOC_MIPS_GOT_OFST - || *r == BFD_RELOC_MIPS_GOT_LO16 - || *r == BFD_RELOC_MIPS_CALL_LO16); + || *r == BFD_RELOC_MIPS_HIGHER + || *r == BFD_RELOC_HI16_S + || *r == BFD_RELOC_LO16 + || *r == BFD_RELOC_MIPS_GOT_OFST); + continue; + + case 'o': + macro_read_relocs (&args, r); continue; case 'u': @@ -9970,6 +9966,9 @@ do_msbd: /* Check whether there is only a single bracketed expression left. If so, it must be the base register and the constant must be zero. */ + offset_reloc[0] = BFD_RELOC_LO16; + offset_reloc[1] = BFD_RELOC_UNUSED; + offset_reloc[2] = BFD_RELOC_UNUSED; if (*s == '(' && strchr (s + 1, '(') == 0) { offset_expr.X_op = O_constant; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index b6e6219..b2f09dc 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-11-13 Richard Sandiford + + * gas/mips/elf-rel28.s, gas/mips/elf-rel28-n32.d, + gas/mips/elf-rel28-n64.d: New test. + * gas/mips/mips.exp: Run it. + 2010-11-10 Richard Sandiford * gas/arm/plt-1.s, gas/arm/plt-1.d: New test. diff --git a/gas/testsuite/gas/mips/elf-rel28-n32.d b/gas/testsuite/gas/mips/elf-rel28-n32.d new file mode 100644 index 0000000..2ba2771 --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel28-n32.d @@ -0,0 +1,96 @@ +#source: elf-rel28.s +#as: -n32 +#objdump: -dr +#name: MIPS ELF reloc 28 (n32) + +.*: file format .* + + +Disassembly of section \.text: + +.* : +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_CALL_HI16 bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_CALL_LO16 bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_CALL16 bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GOT_DISP bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GOT_PAGE bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GOT_OFST bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GOT_HI16 bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GOT_LO16 bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GOT16 bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GPREL16 bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_16 bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_HIGHEST bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_HIGHER bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_SUB bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_GD bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_LDM bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_DTPREL_HI16 bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_DTPREL_LO16 bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_TPREL_HI16 bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_TPREL_LO16 bar +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_GOTTPREL bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_CALL_HI16 bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_CALL_LO16 bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_CALL16 bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GOT_DISP bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GOT_PAGE bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GOT_OFST bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GOT_HI16 bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GOT_LO16 bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GOT16 bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GPREL16 bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_16 bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_HIGHEST bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_HIGHER bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_SUB bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_GD bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_LDM bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_DTPREL_HI16 bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_DTPREL_LO16 bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_TPREL_HI16 bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_TPREL_LO16 bar +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_GOTTPREL bar + ... diff --git a/gas/testsuite/gas/mips/elf-rel28-n64.d b/gas/testsuite/gas/mips/elf-rel28-n64.d new file mode 100644 index 0000000..be38e7d --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel28-n64.d @@ -0,0 +1,180 @@ +#source: elf-rel28.s +#as: -64 +#objdump: -dr +#name: MIPS ELF reloc 28 (n64) + +.*: file format .* + + +Disassembly of section \.text: + +.* : +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_CALL_HI16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_CALL_LO16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_CALL16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GOT_DISP bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GOT_PAGE bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GOT_OFST bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GOT_HI16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GOT_LO16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GOT16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GPREL16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_HIGHEST bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_HIGHER bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_SUB bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_GD bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_LDM bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_DTPREL_HI16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_DTPREL_LO16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_TPREL_HI16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_TPREL_LO16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_TLS_GOTTPREL bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_CALL_HI16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_CALL_LO16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_CALL16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GOT_DISP bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GOT_PAGE bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GOT_OFST bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GOT_HI16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GOT_LO16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GOT16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_GPREL16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_HIGHEST bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_HIGHER bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_SUB bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_GD bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_LDM bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_DTPREL_HI16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_DTPREL_LO16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_TPREL_HI16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_TPREL_LO16 bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* +.*: fc840000 sd a0,0\(a0\) + .*: R_MIPS_TLS_GOTTPREL bar + .*: R_MIPS_NONE \*ABS\* + .*: R_MIPS_NONE \*ABS\* + \.\.\. diff --git a/gas/testsuite/gas/mips/elf-rel28.s b/gas/testsuite/gas/mips/elf-rel28.s new file mode 100644 index 0000000..ec4fb66 --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel28.s @@ -0,0 +1,48 @@ + .ent foo +foo: + # Many of these do not make conceptual sense, but they should + # at least assemble. + ld $4,%call_hi(bar)($4) + ld $4,%call_lo(bar)($4) + ld $4,%call16(bar)($4) + ld $4,%got_disp(bar)($4) + ld $4,%got_page(bar)($4) + ld $4,%got_ofst(bar)($4) + ld $4,%got_hi(bar)($4) + ld $4,%got_lo(bar)($4) + ld $4,%got(bar)($4) + ld $4,%gp_rel(bar)($4) + ld $4,%half(bar)($4) + ld $4,%highest(bar)($4) + ld $4,%higher(bar)($4) + ld $4,%neg(bar)($4) + ld $4,%tlsgd(bar)($4) + ld $4,%tlsldm(bar)($4) + ld $4,%dtprel_hi(bar)($4) + ld $4,%dtprel_lo(bar)($4) + ld $4,%tprel_hi(bar)($4) + ld $4,%tprel_lo(bar)($4) + ld $4,%gottprel(bar)($4) + + sd $4,%call_hi(bar)($4) + sd $4,%call_lo(bar)($4) + sd $4,%call16(bar)($4) + sd $4,%got_disp(bar)($4) + sd $4,%got_page(bar)($4) + sd $4,%got_ofst(bar)($4) + sd $4,%got_hi(bar)($4) + sd $4,%got_lo(bar)($4) + sd $4,%got(bar)($4) + sd $4,%gp_rel(bar)($4) + sd $4,%half(bar)($4) + sd $4,%highest(bar)($4) + sd $4,%higher(bar)($4) + sd $4,%neg(bar)($4) + sd $4,%tlsgd(bar)($4) + sd $4,%tlsldm(bar)($4) + sd $4,%dtprel_hi(bar)($4) + sd $4,%dtprel_lo(bar)($4) + sd $4,%tprel_hi(bar)($4) + sd $4,%tprel_lo(bar)($4) + sd $4,%gottprel(bar)($4) + .end foo diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 3fb5003..6e98082 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -810,6 +810,11 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test_arches "elf-rel27" [mips_arch_list_all] + if $has_newabi { + run_dump_test "elf-rel28-n32" + run_dump_test "elf-rel28-n64" + } + if { !$no_mips16 } { run_dump_test "${tmips}mips${el}16-e" run_dump_test "${tmips}mips${el}16-f" -- 2.7.4