This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: `typeinfo for foo' referenced in section `.text' of bar.o: defined in discarded section `.gnu.linkonce.d._ZTI4foo' of r2.o
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Cc: Kendy Kutzner <kutzner at ira dot uka dot de>, trapni at gentoo dot org
- Date: Fri, 3 Jun 2005 13:27:14 +0930
- Subject: Re: `typeinfo for foo' referenced in section `.text' of bar.o: defined in discarded section `.gnu.linkonce.d._ZTI4foo' of r2.o
On Fri, 20 May 2005 12:03:34 +0200, Kendy Kutzner <kutzner@ira.uka.de> wrote:
[ http://lists.gnu.org/archive/html/bug-binutils/2005-05/msg00133.html ]
This has also been reported to bugzilla.
http://sources.redhat.com/bugzilla/show_bug.cgi?id=568
The following should fix the abort.
PR 568
* elf32-i386.c (elf_i386_relocate_section): Handle zero symndx
for all reloc types.
Applying mainline and branch. I'm also going to put
2005-05-12 H.J. Lu <hongjiu.lu@intel.com>
* elf32-i386.c (elf_i386_relocate_section): Allow R_386_GOTOFF
against protected function when building executable.
on the branch.
Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.141
diff -u -p -r1.141 elf32-i386.c
--- bfd/elf32-i386.c 20 May 2005 22:02:08 -0000 1.141
+++ bfd/elf32-i386.c 2 Jun 2005 14:20:46 -0000
@@ -2270,6 +2270,21 @@ elf_i386_relocate_section (bfd *output_b
unresolved_reloc, warned);
}
+ if (r_symndx == 0)
+ {
+ /* r_symndx will be zero only for relocs against symbols from
+ removed linkonce sections, or sections discarded by a linker
+ script. For these relocs, we just want the section contents
+ zeroed. Avoid any special processing in the switch below. */
+ r_type = R_386_NONE;
+
+ relocation = 0;
+ if (howto->pc_relative)
+ relocation = (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+ }
+
switch (r_type)
{
case R_386_GOT32:
@@ -2426,21 +2441,6 @@ elf_i386_relocate_section (bfd *output_b
case R_386_32:
case R_386_PC32:
- /* 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)
- {
- /* 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);
- break;
- }
-
if ((input_section->flags & SEC_ALLOC) == 0)
break;
--
Alan Modra
IBM OzLabs - Linux Technology Centre