* doc/c-arm.texi: Add new fpe options to list of supported flags.
[deliverable/binutils-gdb.git] / bfd / elf-eh-frame.c
index d39e549369b240ea193846761bd8a7f834d2277f..56a59da410c2b2a366da3891a30de491bb5fe2aa 100644 (file)
@@ -919,14 +919,23 @@ _bfd_elf_write_section_eh_frame (abfd, sec, ehdrsec, contents)
        {
          if (sec_info->entry[i].cie)
            {
-             cie_offset = sec_info->entry[i].new_offset;
-             cie_offset += (sec_info->entry[i].sec->output_section->vma
-                            + sec_info->entry[i].sec->output_offset
-                            - sec->output_section->vma
-                            - sec->output_offset);
+             /* If CIE is removed due to no remaining FDEs referencing it
+                and there were no CIEs kept before it, sec_info->entry[i].sec
+                will be zero.  */
+             if (sec_info->entry[i].sec == NULL)
+               cie_offset = 0;
+             else
+               {
+                 cie_offset = sec_info->entry[i].new_offset;
+                 cie_offset += (sec_info->entry[i].sec->output_section->vma
+                                + sec_info->entry[i].sec->output_offset
+                                - sec->output_section->vma
+                                - sec->output_offset);
+               }
            }
          continue;
        }
+
       if (sec_info->entry[i].cie)
        {
          /* CIE */
@@ -1149,6 +1158,9 @@ _bfd_elf_write_section_eh_frame_hdr (abfd, sec)
              == ELF_INFO_TYPE_EH_FRAME_HDR);
   hdr_info = (struct eh_frame_hdr_info *)
             elf_section_data (sec)->sec_info;
+  if (hdr_info->strip)
+    return true;
+
   size = EH_FRAME_HDR_SIZE;
   if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
     size += 4 + hdr_info->fde_count * 8;
This page took 0.023425 seconds and 4 git commands to generate.