]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas .file 0 vs. dwarf5
authorAlan Modra <amodra@gmail.com>
Wed, 14 May 2025 22:59:37 +0000 (08:29 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 14 May 2025 23:15:46 +0000 (08:45 +0930)
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.

gas/dwarf2dbg.c

index e4b21bc1ae07c50006385021281b128dcf6aec30..a53ad1a150d8e3b7720397b51a74eee9469d0c29 100644 (file)
@@ -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;