* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Zero relocs
[binutils-gdb.git] / bfd / elf-eh-frame.c
index b074ff9285206ac53ec16be5c97bb2be2052da31..e80fc6c9d5704ac6d1119cba11afc5a5ad606ec6 100644 (file)
@@ -506,6 +506,11 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
            }
          read_uleb128 (cie.code_align, buf);
          read_sleb128 (cie.data_align, buf);
+         /* Note - in DWARF2 the return address column is an unsigned byte.
+            In DWARF3 it is a ULEB128.  We are following DWARF3.  For most
+            ports this will not matter as the value will be less than 128.
+            For the others (eg FRV, SH, MMIX, IA64) they need a fixed GCC
+            which conforms to the DWARF3 standard.  */
          read_uleb128 (cie.ra_column, buf);
          ENSURE_NO_RELOCS (buf);
          cie.lsda_encoding = DW_EH_PE_omit;
@@ -627,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
            {