[binutils-gdb] gas .file 0 vs. dwarf5

Alan Modra amodra@sourceware.org
Wed May 14 23:39:23 GMT 2025


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

commit 490ce7e8178261a3aa15c30fc19073c85b5f3a0b
Author: Alan Modra <amodra@gmail.com>
Date:   Thu May 15 08:29:37 2025 +0930

    gas .file 0 vs. dwarf5
    
    Support added in commit 3417bfca676f for dwarf5 directory table 0
    assumed that .file 0 was always the first debug .file directive.
    That's not necessarily true.
    
            * dwarf2dbg.c (get_directory_table_entry): Don't assume entry
            1 is available after putting DW_AT_comp_dir in entry 0.  Pass
            pwd as file0_dirname to recursive call to avoid another
            getpwd in the case file0_dirname is NULL.

Diff:
---
 gas/dwarf2dbg.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index e4b21bc1ae0..a53ad1a150d 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -650,9 +650,8 @@ get_directory_table_entry (const char *dirname,
 		 is set to the current build directory).  Since we are
 		 about to create a directory entry that is not the
 		 same, allocate the current directory first.  */
-	      (void) get_directory_table_entry (pwd, file0_dirname,
-						strlen (pwd), true);
-	      d = 1;
+	      (void) get_directory_table_entry (pwd, pwd, strlen (pwd), true);
+	      d = dirs_in_use;
 	    }
 	  else
 	    d = 0;


More information about the Binutils-cvs mailing list