diff options
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elf32-mips.c | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e4583dd..1858923 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,10 @@ 1999-07-14 Mark Mitchell <mark@codesourcery.com> + * elf32-mips.c (mips_elf_obtain_contents): Swap the 16-bit + subwords when handling an R_MIPS16_26 relocation. + (mips_elf_perform_relocation): Don't be paranoid abour right-shift + semantics. + * elf32-mips.c (elf_mips16_gprel_howto): Adjust src_mask and dst_mask to match reality. (_bfd_mips_elf_calculate_relocation): Handle R_MIPS16_GPREL. diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index 032e02f..b203e08 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -5884,7 +5884,7 @@ mips_elf_calculate_relocation (abfd, case R_MIPS16_26: /* The calculation for R_MIPS_26 is just the same as for an R_MIPS_26. It's only the storage of the relocated field into - the output file that's different. That's handle in + the output file that's different. That's handled in mips_elf_perform_relocation. So, we just fall through to the R_MIPS_26 case here. */ case R_MIPS_26: @@ -6071,6 +6071,12 @@ mips_elf_obtain_contents (howto, relocation, input_bfd, contents) /* Obtain the bytes. */ x = bfd_get (8 * bfd_get_reloc_size (howto), input_bfd, location); + if (ELF32_R_TYPE (relocation->r_info) == R_MIPS16_26 + && bfd_little_endian (input_bfd)) + /* The two 16-bit words will be reversed on a little-endian + system. See mips_elf_perform_relocation for more details. */ + x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16)); + return x; } @@ -6179,7 +6185,7 @@ mips_elf_perform_relocation (info, howto, relocation, value, systems. */ if (bfd_little_endian (input_bfd)) x = (((x & 0xffff) << 16) - | (((x & 0xffff0000) >> 16) & 0xffff)); + | ((x & 0xffff0000) >> 16)); /* Store the value. */ bfd_put_32 (input_bfd, x, location); |