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: releases/gcc-11.2.0~91 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9d954ebd507572a460f93f404bba71e271e2dda;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 7837553958b4..7c75d1314fa8 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -910,7 +910,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;" \