[binutils-gdb] .debug sections without contents

Alan Modra amodra@sourceware.org
Sat Feb 11 06:14:24 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=480ddaa9784c652b7c575e17799e0408ac4e5b01

commit 480ddaa9784c652b7c575e17799e0408ac4e5b01
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Feb 10 23:16:34 2023 +1030

    .debug sections without contents
    
            * dwarf1.c (_bfd_dwarf1_find_nearest_line): Exclude .debug
            sections without contents.

Diff:
---
 bfd/dwarf1.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bfd/dwarf1.c b/bfd/dwarf1.c
index c851f674680..90461004b0a 100644
--- a/bfd/dwarf1.c
+++ b/bfd/dwarf1.c
@@ -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.  */


More information about the Binutils-cvs mailing list