This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Spurious R_386_NONE relocations
On Tue, Aug 24, 2004 at 10:50:54AM -0400, Jeff Baker wrote:
> >OK, this one isn't a linker over-allocation problem, but rather a lack
> >of edit facility for 2.95.x exception handling info. I attached a patch
> >to http://sources.redhat.com/bugzilla/show_bug.cgi?id=343 that may fix
> >your runtime problem.
>
> That patch seems to do the trick. Thanks a lot for your help.
Applying.
bfd/ChangeLog
* elf32-i386.c (elf_i386_relocate_section): Zero section contents
for R_386_32 and R_386_PC32 relocs against symbols defined in
discarded sections.
Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.125
diff -u -p -r1.125 elf32-i386.c
--- bfd/elf32-i386.c 13 Aug 2004 03:15:57 -0000 1.125
+++ bfd/elf32-i386.c 25 Aug 2004 14:08:20 -0000
@@ -2319,8 +2319,19 @@ elf_i386_relocate_section (bfd *output_b
/* r_symndx will be zero only for relocs against symbols
from removed linkonce sections, or sections discarded by
a linker script. */
- if (r_symndx == 0
- || (input_section->flags & SEC_ALLOC) == 0)
+ if (r_symndx == 0)
+ {
+ /* Zero the section contents. eh_frame generated by old
+ versions of gcc isn't edited by elf-eh-frame.c, so
+ FDEs for discarded linkonce functions might remain.
+ Putting zeros here will zero such FDE's address range.
+ This is a hint to unwinders and other consumers of
+ exception handling info that the FDE is invalid. */
+ bfd_put_32 (input_bfd, 0, contents + rel->r_offset);
+ continue;
+ }
+
+ if ((input_section->flags & SEC_ALLOC) == 0)
break;
if ((info->shared
--
Alan Modra
IBM OzLabs - Linux Technology Centre