Make bfd_byte an int8_t, flagword a uint32_t
[binutils-gdb.git] / bfd / elf-eh-frame.c
index 24c6e2c4739018c1e57d0a393c83595318471234..bf7a990235528bd0343be7b3f615437a8988259e 100644 (file)
@@ -1,5 +1,5 @@
 /* .eh_frame section optimization.
-   Copyright (C) 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2023 Free Software Foundation, Inc.
    Written by Jakub Jelinek <jakub@redhat.com>.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -602,6 +602,7 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
   hdr_info = &htab->eh_info;
 
   if (sec->size == 0
+      || (sec->flags & SEC_HAS_CONTENTS) == 0
       || sec->sec_info_type != SEC_INFO_TYPE_NONE)
     {
       /* This file does not contain .eh_frame information.  */
@@ -1612,7 +1613,7 @@ _bfd_elf_discard_section_eh_frame
    input sections.  It finalizes the size of .eh_frame_hdr section.  */
 
 bool
-_bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
+_bfd_elf_discard_section_eh_frame_hdr (struct bfd_link_info *info)
 {
   struct elf_link_hash_table *htab;
   struct eh_frame_hdr_info *hdr_info;
@@ -1644,7 +1645,6 @@ _bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
        sec->size += 4 + hdr_info->u.dwarf.fde_count * 8;
     }
 
-  elf_eh_frame_hdr (abfd) = sec;
   return true;
 }