src/bfd ChangeLog elfxx-mips.c
Thiemo Seufer
ths@networkno.de
Wed Mar 21 07:19:00 GMT 2007
hjl@sourceware.org wrote:
> CVSROOT: /cvs/src
> Module name: src
> Changes by: hjl@sourceware.org 2007-03-21 04:03:10
>
> Modified files:
> bfd : ChangeLog elfxx-mips.c
>
> Log message:
> 2003-03-19 H.J. Lu <hongjiu.lu@intel.com>
>
> PR ld/4208
> * elfxx-mips.c (_bfd_mips_elf_relocate_section): Report missing
> matching LO16 relocation for HI16 relocation.
>
> Patches:
> http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.3774&r2=1.3775
> http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfxx-mips.c.diff?cvsroot=src&r1=1.196&r2=1.197
I believe this is not helpful. What will people do now with their
mildly broken gcc and no fix/update for it? (If there was a specific
fix to gcc post-4.1 which ensures ABI-conformant behaviour then I
missed it.)
What about the appended version instead? The reporter of the PR
confirmed this works for him.
Thiemo
2007-03-21 Thiemo Seufer <ths@mips.com>
* elfxx-mips.c (mips_elf_next_relocation): Don't error out when
a LO16 relocation went missing unxpectedly.
(_bfd_mips_elf_relocate_section): Don't try to compute the low
part of the addend when we didn't find the corresponding LO16
relocation.
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.196
diff -u -p -r1.196 elfxx-mips.c
--- bfd/elfxx-mips.c 7 Mar 2007 08:54:35 -0000 1.196
+++ bfd/elfxx-mips.c 20 Mar 2007 13:45:42 -0000
@@ -3615,7 +3615,6 @@ mips_elf_next_relocation (bfd *abfd ATTR
}
/* We didn't find it. */
- bfd_set_error (bfd_error_bad_value);
return NULL;
}
@@ -7880,32 +7879,36 @@ _bfd_mips_elf_relocate_section (bfd *out
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;
More information about the Binutils
mailing list