aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatherine Moore <clm@redhat.com>2013-05-06 15:00:01 +0000
committerCatherine Moore <clm@redhat.com>2013-05-06 15:00:01 +0000
commit2de39019a22364c903cc23f34e170ef7de4bed03 (patch)
treebdc1a98d1268f5628cd46fcec8b7129477ae7324
parent4d1eb6b4d299f3e46aab18e08fe4ef3063a39565 (diff)
downloadgdb-2de39019a22364c903cc23f34e170ef7de4bed03.zip
gdb-2de39019a22364c903cc23f34e170ef7de4bed03.tar.gz
gdb-2de39019a22364c903cc23f34e170ef7de4bed03.tar.bz2
2013-05-06 Richard Sandiford <rdsandiford@googlemail.com>
* config/tc-mips.c (limited_pcrel_reloc_p): New function. (mips_fix_adjustable): Adjust pc-relative check to use limited_pc_reloc_p.
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-mips.c27
2 files changed, 29 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 417e5ed..5c2c89e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2013-05-06 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * config/tc-mips.c (limited_pcrel_reloc_p): New function.
+ (mips_fix_adjustable): Adjust pc-relative check to use
+ limited_pc_reloc_p.
+
2013-05-02 Richard Sandiford <rdsandiford@googlemail.com>
* config/tc-mips.c (mips_pseudo_table): Add stabd and stabs entries.
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 012935d..9014897 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -2744,6 +2744,24 @@ jalr_reloc_p (bfd_reloc_code_real_type reloc)
return reloc == BFD_RELOC_MIPS_JALR || reloc == BFD_RELOC_MICROMIPS_JALR;
}
+/* Return true if RELOC is a PC-relative relocation that does not have
+ full address range. */
+
+static inline bfd_boolean
+limited_pcrel_reloc_p (bfd_reloc_code_real_type reloc)
+{
+ switch (reloc)
+ {
+ case BFD_RELOC_16_PCREL_S2:
+ case BFD_RELOC_MICROMIPS_7_PCREL_S1:
+ case BFD_RELOC_MICROMIPS_10_PCREL_S1:
+ case BFD_RELOC_MICROMIPS_16_PCREL_S1:
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+}
/* Return true if the given relocation might need a matching %lo().
This is only "might" because SVR4 R_MIPS_GOT16 relocations only
need a matching %lo() when applied to local symbols. */
@@ -17814,11 +17832,12 @@ mips_fix_adjustable (fixS *fixp)
return 0;
/* There is no place to store an in-place offset for JALR relocations.
- Likewise an in-range offset of PC-relative relocations may overflow
- the in-place relocatable field if recalculated against the start
- address of the symbol's containing section. */
+ Likewise an in-range offset of limited PC-relative relocations may
+ overflow the in-place relocatable field if recalculated against the
+ start address of the symbol's containing section. */
if (HAVE_IN_PLACE_ADDENDS
- && (fixp->fx_pcrel || jalr_reloc_p (fixp->fx_r_type)))
+ && (limited_pcrel_reloc_p (fixp->fx_r_type)
+ || jalr_reloc_p (fixp->fx_r_type)))
return 0;
#ifdef OBJ_ELF