69 lines
2.4 KiB
Diff
69 lines
2.4 KiB
Diff
diff -ur binutils-2.17.50.0.12/bfd/elfxx-mips.c binutils-2.17.50.0.12-patched/bfd/elfxx-mips.c
|
|
--- binutils-2.17.50.0.12/bfd/elfxx-mips.c 2006-11-27 16:21:04.000000000 -0600
|
|
+++ binutils-2.17.50.0.12-patched/bfd/elfxx-mips.c 2007-03-20 15:25:42.000000000 -0500
|
|
@@ -3615,7 +3615,6 @@
|
|
}
|
|
|
|
/* We didn't find it. */
|
|
- bfd_set_error (bfd_error_bad_value);
|
|
return NULL;
|
|
}
|
|
|
|
@@ -7849,32 +7848,36 @@
|
|
several relocations for the same address. In
|
|
that case, the R_MIPS_LO16 relocation may occur
|
|
as one of these. We permit a similar extension
|
|
- in general, as that is useful for GCC. */
|
|
+ in general, as that is useful for GCC.
|
|
+
|
|
+ In some cases GCC dead code elimination removes
|
|
+ the LO16 but keeps the corresponding HI16. */
|
|
lo16_relocation = mips_elf_next_relocation (input_bfd,
|
|
lo16_type,
|
|
rel, relend);
|
|
- if (lo16_relocation == NULL)
|
|
- return FALSE;
|
|
-
|
|
- lo16_location = contents + lo16_relocation->r_offset;
|
|
+ if (lo16_relocation != NULL)
|
|
+ {
|
|
+ lo16_location = contents + lo16_relocation->r_offset;
|
|
|
|
- /* Obtain the addend kept there. */
|
|
- lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd,
|
|
- lo16_type, FALSE);
|
|
- _bfd_mips16_elf_reloc_unshuffle (input_bfd, lo16_type, FALSE,
|
|
- lo16_location);
|
|
- l = mips_elf_obtain_contents (lo16_howto, lo16_relocation,
|
|
- input_bfd, contents);
|
|
- _bfd_mips16_elf_reloc_shuffle (input_bfd, lo16_type, FALSE,
|
|
- lo16_location);
|
|
- l &= lo16_howto->src_mask;
|
|
- l <<= lo16_howto->rightshift;
|
|
- l = _bfd_mips_elf_sign_extend (l, 16);
|
|
+ /* Obtain the addend kept there. */
|
|
+ lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd,
|
|
+ lo16_type, FALSE);
|
|
+ _bfd_mips16_elf_reloc_unshuffle (input_bfd, lo16_type,
|
|
+ FALSE, lo16_location);
|
|
+ l = mips_elf_obtain_contents (lo16_howto,
|
|
+ lo16_relocation,
|
|
+ input_bfd, contents);
|
|
+ _bfd_mips16_elf_reloc_shuffle (input_bfd, lo16_type,
|
|
+ FALSE, lo16_location);
|
|
+ l &= lo16_howto->src_mask;
|
|
+ l <<= lo16_howto->rightshift;
|
|
+ l = _bfd_mips_elf_sign_extend (l, 16);
|
|
|
|
- addend <<= 16;
|
|
+ addend <<= 16;
|
|
|
|
- /* Compute the combined addend. */
|
|
- addend += l;
|
|
+ /* Compute the combined addend. */
|
|
+ addend += l;
|
|
+ }
|
|
}
|
|
else
|
|
addend <<= howto->rightshift;
|