* [committed] Fix fallout from MIPS LD & SD macro changes
@ 2010-11-13 12:00 Richard Sandiford
2010-11-15 12:50 ` Tristan Gingold
0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2010-11-13 12:00 UTC (permalink / raw)
To: binutils; +Cc: gingold
The recent changes to the MIPS LD and SD macros trigger a GAS assertion
for instructions like:
ld $4,%gottprel(bar)($4)
(noticed as a failure to build libgomp on mips64-linux-gnu).
The assertion was there to check the types of reloc that are generated
by "real" macro expansion, but we now use 'o' to pass through normal
LD and SD instructions on 64-bit targets, so several more types are
possible.
One fix would have been to add all the reloc types in mips_percent_op to
the assert. However, I think that would run the risk of the two lists
getting out of sync, and would probably also defeat the purpose of the
original assert. Instead, I've dropped the assert from the 'o' case and
kept a restricted form for 'i' and 'j'.
Tested on mips64-linux-gnu and applied. Tristan, since this fixes
a GCC build failure, is it OK for the branch too?
Richard
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.
Index: gas/config/tc-mips.c
===================================================================
--- gas/config/tc-mips.c 2010-11-13 09:43:54.000000000 +0000
+++ gas/config/tc-mips.c 2010-11-13 09:55:57.000000000 +0000
@@ -3765,20 +3765,16 @@ macro_build (expressionS *ep, const char
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':
Index: gas/testsuite/gas/mips/elf-rel28.s
===================================================================
--- /dev/null 2010-11-13 08:36:20.129976896 +0000
+++ gas/testsuite/gas/mips/elf-rel28.s 2010-11-13 10:10:05.000000000 +0000
@@ -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
Index: gas/testsuite/gas/mips/elf-rel28-n32.d
===================================================================
--- /dev/null 2010-11-13 08:36:20.129976896 +0000
+++ gas/testsuite/gas/mips/elf-rel28-n32.d 2010-11-13 10:16:23.000000000 +0000
@@ -0,0 +1,96 @@
+#source: elf-rel28.s
+#as: -n32
+#objdump: -dr
+#name: MIPS ELF reloc 28 (n32)
+
+.*: file format .*
+
+
+Disassembly of section \.text:
+
+.* <foo>:
+.*: 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
+ ...
Index: gas/testsuite/gas/mips/elf-rel28-n64.d
===================================================================
--- /dev/null 2010-11-13 08:36:20.129976896 +0000
+++ gas/testsuite/gas/mips/elf-rel28-n64.d 2010-11-13 10:17:52.000000000 +0000
@@ -0,0 +1,180 @@
+#source: elf-rel28.s
+#as: -64
+#objdump: -dr
+#name: MIPS ELF reloc 28 (n64)
+
+.*: file format .*
+
+
+Disassembly of section \.text:
+
+.* <foo>:
+.*: 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\*
+ \.\.\.
Index: gas/testsuite/gas/mips/mips.exp
===================================================================
--- gas/testsuite/gas/mips/mips.exp 2010-11-13 10:04:48.000000000 +0000
+++ gas/testsuite/gas/mips/mips.exp 2010-11-13 11:33:45.000000000 +0000
@@ -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"
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [committed] Fix fallout from MIPS LD & SD macro changes
2010-11-13 12:00 [committed] Fix fallout from MIPS LD & SD macro changes Richard Sandiford
@ 2010-11-15 12:50 ` Tristan Gingold
0 siblings, 0 replies; 2+ messages in thread
From: Tristan Gingold @ 2010-11-15 12:50 UTC (permalink / raw)
To: Richard Sandiford; +Cc: binutils
On Nov 13, 2010, at 12:59 PM, Richard Sandiford wrote:
> The recent changes to the MIPS LD and SD macros trigger a GAS assertion
> for instructions like:
>
> ld $4,%gottprel(bar)($4)
>
> (noticed as a failure to build libgomp on mips64-linux-gnu).
> The assertion was there to check the types of reloc that are generated
> by "real" macro expansion, but we now use 'o' to pass through normal
> LD and SD instructions on 64-bit targets, so several more types are
> possible.
>
> One fix would have been to add all the reloc types in mips_percent_op to
> the assert. However, I think that would run the risk of the two lists
> getting out of sync, and would probably also defeat the purpose of the
> original assert. Instead, I've dropped the assert from the 'o' case and
> kept a restricted form for 'i' and 'j'.
>
> Tested on mips64-linux-gnu and applied. Tristan, since this fixes
> a GCC build failure, is it OK for the branch too?
Sure.
Tristan.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-15 12:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-13 12:00 [committed] Fix fallout from MIPS LD & SD macro changes Richard Sandiford
2010-11-15 12:50 ` Tristan Gingold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).