]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix build failure on Windows with older binutils
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 9 Jul 2021 10:08:52 +0000 (12:08 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Fri, 9 Jul 2021 10:14:45 +0000 (12:14 +0200)
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.

gcc/gcc.c

index 7837553958b44a124c7d710a6cea0b15d7a041e2..7c75d1314fa8aa246a3e21819dc5faac16dfc322 100644 (file)
--- 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;"                             \