diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-07-14 11:46:04 +0000 |
---|---|---|
committer | Mark Mitchell <mark@codesourcery.com> | 1999-07-14 11:46:04 +0000 |
commit | 85dfdc8028dc38c9dc18d0ceac8b22328673f667 (patch) | |
tree | 962e7bcd34024d6de0a95ebe8739c59461c1df7f | |
parent | 58115123ba0941c9479f31f6e33a0f796c04c566 (diff) | |
download | gdb-85dfdc8028dc38c9dc18d0ceac8b22328673f667.tar.gz |
* 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.
-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 e4583dde33d..18589234f20 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 032e02ffdf6..b203e0821ef 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); |