From 4e84bb7ce1cdfd7c3cc25028d158fceb45e4b7a1 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sat, 6 Dec 2003 13:52:23 +0000 Subject: [PATCH] gas/ * config/tc-mips.c (macro): Switch misordered call to frag_grow() and setting of tc_fr_offset. gas/testsuite/ * gas/mips/elf-rel16.[sd]: New test. * gas/mips/mips.exp: Run it. * gas/mips/elf-rel-xgot-n32.d: Fix addends for "lw $5,dl1+34($5)". * gas/mips/elf-rel-xgot-n64.d: Likewise. --- gas/ChangeLog | 5 +++++ gas/config/tc-mips.c | 2 +- gas/testsuite/ChangeLog | 7 +++++++ gas/testsuite/gas/mips/elf-rel-xgot-n32.d | 4 ++-- gas/testsuite/gas/mips/elf-rel-xgot-n64.d | 12 ++++++------ gas/testsuite/gas/mips/elf-rel16.d | 14 ++++++++++++++ gas/testsuite/gas/mips/elf-rel16.s | 8 ++++++++ gas/testsuite/gas/mips/mips.exp | 1 + 8 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 gas/testsuite/gas/mips/elf-rel16.d create mode 100644 gas/testsuite/gas/mips/elf-rel16.s diff --git a/gas/ChangeLog b/gas/ChangeLog index 679864c4fc..ec4dcb3e64 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2003-12-06 Richard Sandiford + + * config/tc-mips.c (macro): Switch misordered call to frag_grow() + and setting of tc_fr_offset. + 2003-12-05 Ricardo Anguiano Mark Mitchell Richard Earnshaw diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 1afd8bf68e..d60e75f495 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -6348,13 +6348,13 @@ macro (struct mips_cl_insn *ip) lw $tempreg,($gp) (BFD_RELOC_MIPS_GOT_PAGE) $treg,($tempreg) (BFD_RELOC_MIPS_GOT_OFST) */ assert (offset_expr.X_op == O_symbol); + frag_grow (36); frag_now->tc_frag_data.tc_fr_offset = expr1.X_add_number = offset_expr.X_add_number; offset_expr.X_add_number = 0; if (expr1.X_add_number < -0x8000 || expr1.X_add_number >= 0x8000) as_bad (_("PIC code offset overflow (max 16 signed bits)")); - frag_grow (36); macro_build (NULL, &icnt, &offset_expr, "lui", "t,u", tempreg, BFD_RELOC_MIPS_GOT_HI16); macro_build (NULL, &icnt, NULL, ADDRESS_ADD_INSN, "d,v,t", diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 274770dc65..41ee31b2da 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2003-12-06 Richard Sandiford + + * gas/mips/elf-rel16.[sd]: New test. + * gas/mips/mips.exp: Run it. + * gas/mips/elf-rel-xgot-n32.d: Fix addends for "lw $5,dl1+34($5)". + * gas/mips/elf-rel-xgot-n64.d: Likewise. + 2003-12-05 Ricardo Anguiano Mark Mitchell Richard Earnshaw diff --git a/gas/testsuite/gas/mips/elf-rel-xgot-n32.d b/gas/testsuite/gas/mips/elf-rel-xgot-n32.d index 72219310e1..a3f5d0c01c 100644 --- a/gas/testsuite/gas/mips/elf-rel-xgot-n32.d +++ b/gas/testsuite/gas/mips/elf-rel-xgot-n32.d @@ -442,10 +442,10 @@ Disassembly of section \.text: 00000490 8ca50000 lw a1,0\(a1\) 490: R_MIPS_GOT_OFST \.data\+0xc0 00000494 8f810000 lw at,0\(gp\) - 494: R_MIPS_GOT_PAGE \.data\+0xb4 + 494: R_MIPS_GOT_PAGE \.data\+0xd6 00000498 00250821 addu at,at,a1 0000049c 8c250000 lw a1,0\(at\) - 49c: R_MIPS_GOT_OFST \.data\+0xb4 + 49c: R_MIPS_GOT_OFST \.data\+0xd6 000004a0 8f810000 lw at,0\(gp\) 4a0: R_MIPS_GOT_PAGE \.data\+0xec 000004a4 00250821 addu at,at,a1 diff --git a/gas/testsuite/gas/mips/elf-rel-xgot-n64.d b/gas/testsuite/gas/mips/elf-rel-xgot-n64.d index 167b47dd0d..3d4c13d1dd 100644 --- a/gas/testsuite/gas/mips/elf-rel-xgot-n64.d +++ b/gas/testsuite/gas/mips/elf-rel-xgot-n64.d @@ -726,14 +726,14 @@ Disassembly of section \.text: 490: R_MIPS_NONE \*ABS\*\+0xc0 490: R_MIPS_NONE \*ABS\*\+0xc0 0000000000000494 df810000 ld at,0\(gp\) - 494: R_MIPS_GOT_PAGE \.data\+0xb4 - 494: R_MIPS_NONE \*ABS\*\+0xb4 - 494: R_MIPS_NONE \*ABS\*\+0xb4 + 494: R_MIPS_GOT_PAGE \.data\+0xd6 + 494: R_MIPS_NONE \*ABS\*\+0xd6 + 494: R_MIPS_NONE \*ABS\*\+0xd6 0000000000000498 0025082d daddu at,at,a1 000000000000049c dc250000 ld a1,0\(at\) - 49c: R_MIPS_GOT_OFST \.data\+0xb4 - 49c: R_MIPS_NONE \*ABS\*\+0xb4 - 49c: R_MIPS_NONE \*ABS\*\+0xb4 + 49c: R_MIPS_GOT_OFST \.data\+0xd6 + 49c: R_MIPS_NONE \*ABS\*\+0xd6 + 49c: R_MIPS_NONE \*ABS\*\+0xd6 00000000000004a0 df810000 ld at,0\(gp\) 4a0: R_MIPS_GOT_PAGE \.data\+0xec 4a0: R_MIPS_NONE \*ABS\*\+0xec diff --git a/gas/testsuite/gas/mips/elf-rel16.d b/gas/testsuite/gas/mips/elf-rel16.d new file mode 100644 index 0000000000..9b15077eef --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel16.d @@ -0,0 +1,14 @@ +#objdump: -dr +#as: -mabi=n32 -mips3 -xgot -KPIC + +.*: file format .* + +Disassembly of section \.text: + +00000000 <.*>: + \.\.\. +.*: 8f840000 lw a0,0\(gp\) + .*: R_MIPS_GOT_PAGE \.rodata\+0x8 +.*: dc840000 ld a0,0\(a0\) + .*: R_MIPS_GOT_OFST \.rodata\+0x8 + \.\.\. diff --git a/gas/testsuite/gas/mips/elf-rel16.s b/gas/testsuite/gas/mips/elf-rel16.s new file mode 100644 index 0000000000..e7d5938c06 --- /dev/null +++ b/gas/testsuite/gas/mips/elf-rel16.s @@ -0,0 +1,8 @@ + .rept 0x3e0 + nop + .endr + ld $4,foo+8 + .space 16 + .section .rodata +foo: + .word 1,2,3,4 diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index c4fd0c744b..fa8a9a9648 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -663,6 +663,7 @@ if { [istarget mips*-*-*] } then { if $has_newabi { run_dump_test "elf-rel15" + run_dump_test "elf-rel16" run_dump_test "elf-rel-got-n32" run_dump_test "elf-rel-xgot-n32" -- 2.11.0