.debug sections without contents
authorAlan Modra <amodra@gmail.com>
Fri, 10 Feb 2023 12:46:34 +0000 (23:16 +1030)
committerAlan Modra <amodra@gmail.com>
Sat, 11 Feb 2023 06:11:00 +0000 (16:41 +1030)
* dwarf1.c (_bfd_dwarf1_find_nearest_line): Exclude .debug
sections without contents.

bfd/dwarf1.c

index c851f674680fb85a1f3c9e5cee063086f3edf25c..90461004b0a546466a70d89d25fcb7229489d48f 100644 (file)
@@ -510,7 +510,8 @@ _bfd_dwarf1_find_nearest_line (bfd *abfd,
        return false;
 
       msec = bfd_get_section_by_name (abfd, ".debug");
-      if (! msec)
+      if (! msec
+         || (msec->flags & SEC_HAS_CONTENTS) == 0)
        /* No dwarf1 info.  Note that at this point the stash
           has been allocated, but contains zeros, this lets
           future calls to this function fail quicker.  */