From d31c858cf13d65e1b8e6d94848760a29cce6ba7b Mon Sep 17 00:00:00 2001 From: Thiemo Seufer Date: Sun, 2 Mar 2003 21:30:14 +0000 Subject: * elf32-mips.c (elf_mips_howto_table_rel): Change definition of R_MIPS_PC16 to rightshift 2. (elf_reloc_map mips_reloc_map): Map to rightshifted BFD reloc. (bfd_elf32_bfd_reloc_type_lookup): Support BFD_RELOC_MIPSEMB_16_PCREL_S2. * elf64-mips.c (mips_elf64_howto_table_rel): Change definition of R_MIPS_PC16 to rightshift 2. (mips_elf64_howto_table_rela): Likewise. (mips_reloc_map): Map to rightshifted BFD reloc. * elfn32-mips.c: The same as in elf64-mips.c. * elfxx-mips.c (mips_elf_got_for_ibfd): Typo in comment. (mips_elf_calculate_relocation): Handle rightshifted addends for R_MIPS_PC16. * reloc.c (BFD_RELOC_MIPSEMB_16_PCREL_S2): New BFD relocation for MIPS Embedded PIC. Remove superfluous empty COMMENT. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. * config/tc-mips.c (append_insn): Add handling of BFD_RELOC_MIPSEMB_16_PCREL_S2. Avoid emitting unneeded BFD_RELOC_16_PCREL_S2 relocs and add earlier warnings about misaligned address and reange overflow. (macro_build): Add handling of BFD_RELOC_MIPSEMB_16_PCREL_S2. Add earlier warnings about misaligned address and reange overflow. (mips_ip): Add handling of BFD_RELOC_MIPSEMB_16_PCREL_S2. (md_apply_fix): Likewise. Fix warning output. (tc_gen_reloc): Add handling of BFD_RELOC_MIPSEMB_16_PCREL_S2. Allow BFD_RELOC_16_PCREL_S2 for all ABIs. (md_convert_frag): Add handling of BFD_RELOC_MIPSEMB_16_PCREL_S2. * gas/mips/bge.d: Reactivate external branch tests. * gas/mips/bge.s: Likewise. * gas/mips/bgeu.d: Likewise. * gas/mips/bgeu.s: Likewise. * gas/mips/blt.d: Likewise. * gas/mips/blt.s: Likewise. * gas/mips/bltu.d: Likewise. * gas/mips/bltu.s: Likewise. * gas/mips/branch-misc-2.d: New File. * gas/mips/branch-misc-2.l: Remove. * gas/mips/mips.exp: Adjust branch-misc-2 test. --- bfd/elfxx-mips.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'bfd/elfxx-mips.c') diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 2295fa8b17c..6ca4f063af2 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -496,7 +496,6 @@ static struct mips_got_info *mips_elf_got_for_ibfd static bfd *reldyn_sorting_bfd; /* Nonzero if ABFD is using the N32 ABI. */ - #define ABI_N32_P(abfd) \ ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0) @@ -2130,7 +2129,7 @@ mips_elf_bfd2got_entry_eq (entry1, entry2) return e1->bfd == e2->bfd; } -/* In a multi-got link, determine the GOT to be used for IBDF. G must +/* In a multi-got link, determine the GOT to be used for IBFD. G must be the master GOT data. */ static struct mips_got_info * @@ -3316,12 +3315,6 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, value &= howto->dst_mask; break; - case R_MIPS_GNU_REL16_S2: - value = symbol + mips_elf_sign_extend (addend << 2, 18) - p; - overflowed_p = mips_elf_overflow_p (value, 18); - value = (value >> 2) & howto->dst_mask; - break; - case R_MIPS_GNU_REL_HI16: /* Instead of subtracting 'p' here, we should be subtracting the equivalent value for the LO part of the reloc, since the value @@ -3450,8 +3443,10 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, break; case R_MIPS_PC16: - value = mips_elf_sign_extend (addend, 16) + symbol - p; - overflowed_p = mips_elf_overflow_p (value, 16); + case R_MIPS_GNU_REL16_S2: + value = mips_elf_sign_extend (addend << 2, 18) + symbol - p; + overflowed_p = mips_elf_overflow_p (value, 18); + value = (value >> 2) & howto->dst_mask; break; case R_MIPS_GOT_HI16: -- cgit v1.2.1