From: Eric Botcazou Date: Fri, 9 Jul 2021 10:08:52 +0000 (+0200) Subject: Fix build failure on Windows with older binutils X-Git-Tag: basepoints/gcc-13~6124 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e37e175e7dc3376244eb7705269ada6755616831;p=thirdparty%2Fgcc.git Fix build failure on Windows with older binutils This is the build failure on Windows with binutils for which GNU as accepts the --gdwarf-5 switch but GNU ld generates broken binaries with DWARF 5. We already have the HAVE_LD_BROKEN_PE_DWARF5 kludge to disable DWARF 5 in this case but it only tames the DWARF version in the compiler, so the driver still passes --gdwarf-5 when invoked on an assembly file with -g. gcc/ PR target/101377 * gcc.c (ASM_DEBUG_DWARF_OPTION): Set again to --gdwarf2 in the case where HAVE_AS_WORKING_DWARF_N_FLAG is not defined and HAVE_LD_BROKEN_PE_DWARF5 is defined. --- diff --git a/gcc/gcc.c b/gcc/gcc.c index 36a88fc99b0e..f086dd47b912 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -916,7 +916,7 @@ proper position among the other output files. */ than in ASM_DEBUG_SPEC, so that it applies to both .s and .c etc. compilations. */ # define ASM_DEBUG_DWARF_OPTION "" -# elif defined(HAVE_AS_GDWARF_5_DEBUG_FLAG) +# elif defined(HAVE_AS_GDWARF_5_DEBUG_FLAG) && !defined(HAVE_LD_BROKEN_PE_DWARF5) # define ASM_DEBUG_DWARF_OPTION "%{%:dwarf-version-gt(4):--gdwarf-5;" \ "%:dwarf-version-gt(3):--gdwarf-4;" \ "%:dwarf-version-gt(2):--gdwarf-3;" \