From: Alan Modra Date: Wed, 14 May 2025 22:59:37 +0000 (+0930) Subject: gas .file 0 vs. dwarf5 X-Git-Tag: binutils-2_45~587 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=490ce7e8178261a3aa15c30fc19073c85b5f3a0b;p=thirdparty%2Fbinutils-gdb.git 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 --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;