Message ID | 11784456.O9o76ZdvQC@fomalhaut |
---|---|
State | New |
Headers | show |
Series | Fix PR target/101377 | expand |
On Fri, Jul 9, 2021 at 9:41 AM Eric Botcazou <botcazou@adacore.com> wrote: > > Hi, > > 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. > > The attached patch is a minimal fix to plug the hole, and I don't think that > anything more sophisticated is worth the hassle since 2.37 supports DWARF 5, > i.e. HAVE_AS_GDWARF_5_DEBUG_FLAG and HAVE_AS_WORKING_DWARF_N_FLAG are defined > and HAVE_LD_BROKEN_PE_DWARF5 is not with it. > > Tested on x86-64/Linux and x86[-64]/Windows, OK for mainline and 11 branch? OK. Thanks, Richard. > > 2021-07-07 Eric Botcazou <ebotcazou@adacore.com> > > PR target/101377 > * gcc.c.c (ASM_DEBUG_DWARF_OPTION): Set again to --gdwarf2 > if HAVE_AS_WORKING_DWARF_N_FLAG is not defined > and HAVE_LD_BROKEN_PE_DWARF5 is defined. > > -- > Eric Botcazou
diff --git a/gcc/gcc.c b/gcc/gcc.c index 7837553958b..7c75d1314fa 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;" \