https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98708
--- Comment #11 from Mark Wielaard <mark at gcc dot gnu.org> --- Aha, now I see in libstdc++-v3/src/c++11/Makefile.am: if ENABLE_DUAL_ABI # Rewrite the type info for __ios_failure. rewrite_ios_failure_typeinfo = sed -e '/^_*_ZTISt13__ios_failure:/,/_ZTVN10__cxxabiv120__si_class_type_infoE/s/_ZTVN10__cxxabiv120__si_class_type_infoE/_ZTVSt19__iosfail_type_info/' cxx11-ios_failure-lt.s: cxx11-ios_failure.cc $(LTCXXCOMPILE) -S $< -o tmp-cxx11-ios_failure-lt.s -test -f tmp-cxx11-ios_failure-lt.o && mv -f tmp-cxx11-ios_failure-lt.o tmp-cxx11-ios_failure-lt.s $(rewrite_ios_failure_typeinfo) tmp-$@ > $@ -rm -f tmp-$@ cxx11-ios_failure.s: cxx11-ios_failure.cc $(CXXCOMPILE) -S $< -o tmp-$@ $(rewrite_ios_failure_typeinfo) tmp-$@ > $@ -rm -f tmp-$@ cxx11-ios_failure.lo: cxx11-ios_failure-lt.s $(LTCXXCOMPILE) -g0 -c $< -o $@ cxx11-ios_failure.o: cxx11-ios_failure.s $(CXXCOMPILE) -g0 -c $< endif Then my workaround of checking for debug_info_level > DINFO_LEVEL_NONE indeed wouldn't work. It is explicitly generating debuginfo for the assembly file and then adding -g0 when turning the assembly file into an object file. So that is too late. I don't think adding -gno-as-loc-support to the -S invocation will work because of the definition of asm_outputs_debug_line_str () which is true if dwarf_version >= 5 && ! output_asm_line_debug_info () && DWARF5_USE_DEBUG_LINE_STR. So then it will still generate the .file 0 directive. Ideally gas wouldn't error on .file 0, but simply ignore it when not generating DWARF5. Maybe the simplest workaround for now would be also adding -g0 to the -S invocations?