]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR 568
authorAlan Modra <amodra@gmail.com>
Fri, 3 Jun 2005 04:00:18 +0000 (04:00 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 3 Jun 2005 04:00:18 +0000 (04:00 +0000)
* elf32-i386.c (elf_i386_relocate_section): Handle zero symndx
for all reloc types.

Apply from mainline:
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.

bfd/ChangeLog
bfd/elf32-i386.c

index bd81db1f8a58a7ab08085b1dcf3064485abde12d..24b318f65d52e0178e71a496d81a63404b4bd0bc 100644 (file)
@@ -1,4 +1,15 @@
-2005-06-02  Alan Modra  <amodra@bigpond.net.au>
+2005-06-03  Alan Modra  <amodra@bigpond.net.au>
+
+       PR 568
+       * elf32-i386.c (elf_i386_relocate_section): Handle zero symndx
+       for all reloc types.
+
+       Apply from mainline:
+       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.
+
+2005-06-03  Alan Modra  <amodra@bigpond.net.au>
 
        * elf64-ppc.c (add_symbol_adjust): Set sym visibility to most
        restrictive of func code and func descr for undefined syms as well
index 9bab9be124435762a4b528884dfa732b62694e49..66b94932774a12c1d016d1897494bf4b1562b24a 100644 (file)
@@ -2177,6 +2177,21 @@ elf_i386_relocate_section (bfd *output_bfd,
                                   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:
@@ -2278,6 +2293,7 @@ elf_i386_relocate_section (bfd *output_bfd,
             for shared library since it may not be local when used
             as function address.  */
          if (info->shared
+             && !info->executable
              && h
              && h->def_regular
              && h->type == STT_FUNC
@@ -2332,21 +2348,6 @@ elf_i386_relocate_section (bfd *output_bfd,
 
        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;