https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101431
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #5) > (In reply to Richard Biener from comment #4) > > > cat tmp/t.c > > void foo(int i) {} > > > gcc-11 -g -o tmp/t.o tmp/t.c -c > > > > and the DWARF ends up > > > > <0><c>: Abbrev Number: 1 (DW_TAG_compile_unit) > > <d> DW_AT_producer : (indirect string, offset: 0x0): GNU C17 11.1.1 > > 20210428 -mtune=generic -march=x86-64 -g > > <11> DW_AT_language : 29 (C11) > > <12> DW_AT_name : (indirect line string, offset: 0x0): tmp/t.c > > <16> DW_AT_comp_dir : (indirect line string, offset: 0x8): / > > <1a> DW_AT_low_pc : 0x0 > > <22> DW_AT_high_pc : 0xa > > <2a> DW_AT_stmt_list : 0x0 > > > > ... > > The Directory Table (offset 0x22, lines 2, columns 1): > > Entry Name > > 0 (indirect line string, offset: 0xa): tmp > > 1 (indirect line string, offset: 0xe): tmp > > > > The File Name Table (offset 0x30, lines 2, columns 2): > > Entry Dir Name > > 0 0 (indirect line string, offset: 0x12): tmp/t.c > > 1 1 (indirect line string, offset: 0x1a): t.c > > > > I suspect this is because of how GCC and gas together end up producing > > .debug_line - we have > > > > .file "t.c" > > .text > > ... > > foo: > > .LFB0: > > .file 1 "tmp/t.c" > > ... > > .section .debug_line,"",@progbits > > .Ldebug_line0: > > .file 0 "/" "tmp/t.c" > > > > but this .file 0 ends up taking the place of comp-dir and it also > > ends up duplicating the file entry for t.c unnecessarily. I'm not > > familiar with how the DWARF5 stuff was set up so I hope somebody > > else can have a look. > > > > Note the referenced testcase in github uses -gsplit-dwarf. > > This was with binutils 2.36.1 and GCC configured against that. But it looks good (apart from duplicated file entry) with -gno-as-loc-support: The Directory Table (offset 0x22, lines 2, columns 1): Entry Name 0 (indirect line string, offset: 0x10): / 1 (indirect line string, offset: 0x0): tmp The File Name Table (offset 0x30, lines 2, columns 2): Entry Dir Name 0 0 (indirect line string, offset: 0x4): tmp/t.c 1 1 (indirect line string, offset: 0xc): t.c it looks like some configury doesn't work as expected? The driver passes --gdwarf-5 to the assembler.