Hi, On Tue, 2020-09-15 at 20:40 +0200, Jakub Jelinek wrote: > Ok, here it is in patch form. > I've briefly tested it, with the older binutils I have around (no --gdwarf-N > support), with latest gas (--gdwarf-N that can be passed to as even when > compiling C/C++ etc. code and emitting .debug_line) and latest gas with Mark's fix > reverted (--gdwarf-N support, but can only pass it to as when assembling > user .s/.S files, not when compiling C/C++ etc.). > Will bootstrap/regtest (with the older binutils) later tonight. > > 2020-09-15 Jakub Jelinek > > * configure.ac (HAVE_AS_GDWARF_5_DEBUG_FLAG, > HAVE_AS_WORKING_DWARF_4_FLAG): New tests. > * gcc.c (ASM_DEBUG_DWARF_OPTION): Define. > (ASM_DEBUG_SPEC): Use ASM_DEBUG_DWARF_OPTION instead of > "--gdwarf2". Use %{cond:opt1;:opt2} style. > (ASM_DEBUG_OPTION_DWARF_OPT): Define. > (ASM_DEBUG_OPTION_SPEC): Define. > (asm_debug_option): New variable. > (asm_options): Add "%(asm_debug_option)". > (static_specs): Add asm_debug_option entry. > (static_spec_functions): Add dwarf-version-gt. > (debug_level_greater_than_spec_func): New function. > * config/darwin.h (ASM_DEBUG_OPTION_SPEC): Define. > * config/darwin9.h (ASM_DEBUG_OPTION_SPEC): Redefine. > * config.in: Regenerated. > * configure: Regenerated. Once this is in we can more generally emit DW_FORM_line_str for filepaths in CU DIEs for the name and comp_dir attribute. There currently is a bit of a hack to do this in dwarf2out_early_finish, but that only works when the assembler doesn't emit a DWARF5 .debug_line, but gcc does it itself. What do you think of the attached patch?