* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Zero relocs
authorAlan Modra <amodra@gmail.com>
Mon, 23 Sep 2002 10:52:03 +0000 (10:52 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 23 Sep 2002 10:52:03 +0000 (10:52 +0000)
for discarded FDEs.  Remove redundant assignment.
* elflink.h (elf_bfd_discard_info): Save edited relocs.

bfd/ChangeLog
bfd/elf-eh-frame.c
bfd/elflink.h

index a3e243f22315dfcf0876371bbe71c2ab011b6f46..1f84b066019c724163e7558e2517952890177b93 100644 (file)
@@ -1,3 +1,9 @@
+2002-09-23  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Zero relocs
+       for discarded FDEs.  Remove redundant assignment.
+       * elflink.h (elf_bfd_discard_info): Save edited relocs.
+
 2002-09-22  H.J. Lu <hjl@gnu.org>
 
        * elf64-alpha.c (elf64_alpha_merge_ind_symbols): Don't merge
index eb4a69b04d0583dbd8a255580c540f72e5848db5..e80fc6c9d5704ac6d1119cba11afc5a5ad606ec6 100644 (file)
@@ -632,11 +632,11 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
            goto free_no_table;
          if ((*reloc_symbol_deleted_p) (buf - ehbuf, cookie))
            {
-             cookie->rel = rel;
              /* This is a FDE against discarded section, it should
                 be deleted.  */
              new_size -= hdr.length + 4;
              sec_info->entry[sec_info->count].removed = 1;
+             memset (rel, 0, sizeof (*rel));
            }
          else
            {
index 2df334b1e48fd216d6497ec548f3cc5def88470e..85160e90257c6f1261081d46044842d1d44f65e4 100644 (file)
@@ -8482,7 +8482,12 @@ elf_bfd_discard_info (output_bfd, info)
          if (_bfd_elf_discard_section_eh_frame (abfd, info, eh, ehdr,
                                                 elf_reloc_symbol_deleted_p,
                                                 &cookie))
-           ret = true;
+           {
+             /* Relocs have been edited.  Ensure edited version is
+                used later in relocate_section.  */
+             elf_section_data (eh)->relocs = cookie.rels;
+             ret = true;
+           }
          if (cookie.rels && elf_section_data (eh)->relocs != cookie.rels)
            free (cookie.rels);
        }