* elf32-i386.c (elf_i386_relocate_section): Zero section contents
authorAlan Modra <amodra@gmail.com>
Wed, 25 Aug 2004 14:35:58 +0000 (14:35 +0000)
committerAlan Modra <amodra@gmail.com>
Wed, 25 Aug 2004 14:35:58 +0000 (14:35 +0000)
for R_386_32 and R_386_PC32 relocs against symbols defined in
discarded sections.

bfd/ChangeLog
bfd/elf32-i386.c

index a0a9fc43366559cd78eb675f6a17f69669e430b2..dbe1df945ce9629f2921ff6de704cb71bf5b9c00 100644 (file)
@@ -1,9 +1,15 @@
+2004-08-25  Alan Modra  <amodra@bigpond.net.au>
+
+       * 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.
+
 2004-08-25  Dmitry Diky  <diwil@spec.ru>
 
        * reloc.c (BFD_RELOC_MSP430_2X_PCREL,BFD_RELOC_MSP430_RL_PCREL):
        Add new relocations.
        * bfd-in2.h: Regenerate.
-       * libbfd.h: Regenerate..
+       * libbfd.h: Regenerate.
        * elf32-msp430.c: Clean-up code.
        (elf_msp430_howto_table): Add new relocation entries.
        (bfd_elf32_bfd_reloc_type_lookup): New relocation handlers.
index 5eb34abe62ff27e3e77313f812e92ba5c60eb228..855b98511688750cfbee3457bd4a37983b8b5eb1 100644 (file)
@@ -2319,8 +2319,19 @@ elf_i386_relocate_section (bfd *output_bfd,
          /* 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
This page took 0.033311 seconds and 4 git commands to generate.