aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2009-09-21 19:32:47 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2009-09-21 19:32:47 +0000
commit416792b8f7aa333cfe57c382fb69118a36feeadf (patch)
tree4d57834fcf3572444f03ded9db31bc0bed14cbd8
parentf115d60e9da0545b6848ab74a8b037ad1776789d (diff)
downloadgdb-416792b8f7aa333cfe57c382fb69118a36feeadf.zip
gdb-416792b8f7aa333cfe57c382fb69118a36feeadf.tar.gz
gdb-416792b8f7aa333cfe57c382fb69118a36feeadf.tar.bz2
gas/
* config/tc-mips.c (MIPS_JALR_HINT_P): Take an expr argument. Require the target to be a bare symbol on targets with in-place addends. (macro_build_jalr): Update accordingly. (mips_fix_adjustable): Don't reduce R_MIPS_JALRs on targets with in-place addends. gas/testsuite/ * gas/mips/jalr2.s, gas/mips/jalr2.d: New test. * gas/mips/jal-svr4pic.d: Don't expect R_MIPS_JALRs to be reduced. * gas/mips/jal-xgot.d: Likewise. * gas/mips/mips-abi32-pic2.d: Likewise. * gas/mips/mips.exp: Run it.
-rw-r--r--gas/ChangeLog9
-rw-r--r--gas/config/tc-mips.c18
-rw-r--r--gas/testsuite/ChangeLog8
-rw-r--r--gas/testsuite/gas/mips/jal-svr4pic.d2
-rw-r--r--gas/testsuite/gas/mips/jal-xgot.d2
-rw-r--r--gas/testsuite/gas/mips/mips-abi32-pic2.d6
-rw-r--r--gas/testsuite/gas/mips/mips.exp1
7 files changed, 36 insertions, 10 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index a385387..16d158c 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,12 @@
+2009-09-21 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * config/tc-mips.c (MIPS_JALR_HINT_P): Take an expr argument.
+ Require the target to be a bare symbol on targets with
+ in-place addends.
+ (macro_build_jalr): Update accordingly.
+ (mips_fix_adjustable): Don't reduce R_MIPS_JALRs on targets
+ with in-place addends.
+
2009-09-21 Ben Elliston <bje@au.ibm.com>
Peter Bergner <bergner@vnet.ibm.com>
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index e1d6388..1c96480 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -292,10 +292,14 @@ static int file_ase_mips16;
/* True if we want to create R_MIPS_JALR for jalr $25. */
#ifdef TE_IRIX
-#define MIPS_JALR_HINT_P HAVE_NEWABI
+#define MIPS_JALR_HINT_P(EXPR) HAVE_NEWABI
#else
-/* As a GNU extension, we use R_MIPS_JALR for o32 too. */
-#define MIPS_JALR_HINT_P 1
+/* As a GNU extension, we use R_MIPS_JALR for o32 too. However,
+ because there's no place for any addend, the only acceptable
+ expression is a bare symbol. */
+#define MIPS_JALR_HINT_P(EXPR) \
+ (!HAVE_IN_PLACE_ADDENDS \
+ || ((EXPR)->X_op == O_symbol && (EXPR)->X_add_number == 0))
#endif
/* True if -mips3d was passed or implied by arguments passed on the
@@ -3930,13 +3934,13 @@ macro_build_jalr (expressionS *ep)
{
char *f = NULL;
- if (MIPS_JALR_HINT_P)
+ if (MIPS_JALR_HINT_P (ep))
{
frag_grow (8);
f = frag_more (0);
}
macro_build (NULL, "jalr", "d,s", RA, PIC_CALL_REG);
- if (MIPS_JALR_HINT_P)
+ if (MIPS_JALR_HINT_P (ep))
fix_new_exp (frag_now, f - frag_now->fr_literal,
4, ep, FALSE, BFD_RELOC_MIPS_JALR);
}
@@ -14097,6 +14101,10 @@ mips_fix_adjustable (fixS *fixp)
&& (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_MERGE) != 0)
return 0;
+ /* There is no place to store an in-place offset for JALR relocations. */
+ if (fixp->fx_r_type == BFD_RELOC_MIPS_JALR && HAVE_IN_PLACE_ADDENDS)
+ return 0;
+
#ifdef OBJ_ELF
/* R_MIPS16_26 relocations against non-MIPS16 functions might resolve
to a floating-point stub. The same is true for non-R_MIPS16_26
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 6fd1dec..8da56921 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2009-09-21 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * gas/mips/jalr2.s, gas/mips/jalr2.d: New test.
+ * gas/mips/jal-svr4pic.d: Don't expect R_MIPS_JALRs to be reduced.
+ * gas/mips/jal-xgot.d: Likewise.
+ * gas/mips/mips-abi32-pic2.d: Likewise.
+ * gas/mips/mips.exp: Run it.
+
2009-09-21 Maciej W. Rozycki <macro@linux-mips.org>
* lib/gas-defs.exp (gas_test_error): Mark internal error/assertion
diff --git a/gas/testsuite/gas/mips/jal-svr4pic.d b/gas/testsuite/gas/mips/jal-svr4pic.d
index ef51f4b..3fc206d 100644
--- a/gas/testsuite/gas/mips/jal-svr4pic.d
+++ b/gas/testsuite/gas/mips/jal-svr4pic.d
@@ -26,7 +26,7 @@ Disassembly of section .text:
0+0034 <[^>]*> addiu t9,t9,0
[ ]*34: R_MIPS_LO16 .text
0+0038 <[^>]*> jalr t9
-[ ]*38: R_MIPS_JALR .text
+[ ]*38: R_MIPS_JALR text_label
0+003c <[^>]*> nop
0+0040 <[^>]*> lw gp,0\(sp\)
0+0044 <[^>]*> nop
diff --git a/gas/testsuite/gas/mips/jal-xgot.d b/gas/testsuite/gas/mips/jal-xgot.d
index 89a9b42..2ece157 100644
--- a/gas/testsuite/gas/mips/jal-xgot.d
+++ b/gas/testsuite/gas/mips/jal-xgot.d
@@ -27,7 +27,7 @@ Disassembly of section .text:
0+0034 <[^>]*> addiu t9,t9,0
[ ]*34: R_MIPS_LO16 .text
0+0038 <[^>]*> jalr t9
-[ ]*38: R_MIPS_JALR .text
+[ ]*38: R_MIPS_JALR text_label
0+003c <[^>]*> nop
0+0040 <[^>]*> lw gp,0\(sp\)
0+0044 <[^>]*> lui t9,0x0
diff --git a/gas/testsuite/gas/mips/mips-abi32-pic2.d b/gas/testsuite/gas/mips/mips-abi32-pic2.d
index 5336780..aca0dbd 100644
--- a/gas/testsuite/gas/mips/mips-abi32-pic2.d
+++ b/gas/testsuite/gas/mips/mips-abi32-pic2.d
@@ -16,7 +16,7 @@ Disassembly of section \.text:
0+014 <[^>]*> 273900cc addiu t9,t9,204
14: R_MIPS_LO16 \.text
0+018 <[^>]*> 0320f809 jalr t9
- 18: R_MIPS_JALR \.text
+ 18: R_MIPS_JALR end
0+01c <[^>]*> 00000000 nop
0+020 <[^>]*> 8fbc0008 lw gp,8\(sp\)
0+024 <[^>]*> 00000000 nop
@@ -36,7 +36,7 @@ Disassembly of section \.text:
0+050 <[^>]*> 273900cc addiu t9,t9,204
50: R_MIPS_LO16 \.text
0+054 <[^>]*> 0320f809 jalr t9
- 54: R_MIPS_JALR \.text
+ 54: R_MIPS_JALR end
0+058 <[^>]*> 00000000 nop
0+05c <[^>]*> 3c010001 lui at,0x1
0+060 <[^>]*> 003d0821 addu at,at,sp
@@ -60,7 +60,7 @@ Disassembly of section \.text:
0+09c <[^>]*> 273900cc addiu t9,t9,204
9c: R_MIPS_LO16 \.text
0+0a0 <[^>]*> 0320f809 jalr t9
- a0: R_MIPS_JALR \.text
+ a0: R_MIPS_JALR end
0+0a4 <[^>]*> 00000000 nop
0+0a8 <[^>]*> 3c010001 lui at,0x1
0+0ac <[^>]*> 003d0821 addu at,at,sp
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index ebe17c5..6f82f46 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -706,6 +706,7 @@ if { [istarget mips*-*-vxworks*] } {
run_list_test "tls-ill" "-32"
run_dump_test "tls-o32"
+ run_dump_test "jalr2"
}
if $has_newabi {