From: Catherine Moore Date: Mon, 6 May 2013 15:00:01 +0000 (+0000) Subject: 2013-05-06 Richard Sandiford X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2de39019a22364c903cc23f34e170ef7de4bed03;p=binutils-gdb.git 2013-05-06 Richard Sandiford * config/tc-mips.c (limited_pcrel_reloc_p): New function. (mips_fix_adjustable): Adjust pc-relative check to use limited_pc_reloc_p. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 417e5ed532d..5c2c89e05d1 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2013-05-06 Richard Sandiford + + * 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 * 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 012935d354c..9014897d4b6 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