While GNU as only allows the directory form of the .file directive for DWARF v5,
the integrated assembler prefers the directory form on all DWARF versions
(-fdwarf-directory-asm).
We currently set CC1 -fno-dwarf-directory-asm for -fno-integrated-as -gdwarf-5
which may cause the directory entry 0 and the filename entry 0 to be incorrect
(see D105662 and the example below). This patch makes -fno-integrated-as -gdwarf-5 use
-fdwarf-directory-asm as well.
cd /tmp/c before % clang -g -gdwarf-5 -fno-integrated-as e/a.c -S -o - | grep '\.file.*0' .file 0 "/tmp/c/e/a.c" md5 0x97e31cee64b4e58a4af8787512d735b6 % clang -g -gdwarf-5 -fno-integrated-as e/a.c -c % llvm-dwarfdump a.o | grep include_directories include_directories[ 0] = "/tmp/c/e" after % clang -g -gdwarf-5 -fno-integrated-as e/a.c -S -o - | grep '\.file.*0' .file 0 "/tmp/c" "e/a.c" md5 0x97e31cee64b4e58a4af8787512d735b6 % clang -g -gdwarf-5 -fno-integrated-as e/a.c -c % llvm-dwarfdump a.o | grep include_directories include_directories[ 0] = "/tmp/c"