Re: [PATCH v6 2/2] Kbuild: implement support for DWARF v5

From: Nick Desaulniers
Date: Fri Jan 29 2021 - 15:50:54 EST


On Fri, Jan 29, 2021 at 12:41 PM Sedat Dilek <sedat.dilek@xxxxxxxxx> wrote:
>
> On Fri, Jan 29, 2021 at 8:43 PM Nick Desaulniers
> <ndesaulniers@xxxxxxxxxx> wrote:
> >
> > diff --git a/Makefile b/Makefile
> > index 20141cd9319e..bed8b3b180b8 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -832,8 +832,20 @@ endif
> >
> > dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2
> > dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
> > +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5
> > DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
> >
> > +# If using clang without the integrated assembler, we need to explicitly tell
> > +# GAS that we will be feeding it DWARF v5 assembler directives. Kconfig should
> > +# detect whether the version of GAS supports DWARF v5.
> > +ifdef CONFIG_CC_IS_CLANG
> > +ifneq ($(LLVM_IAS),1)
> > +ifeq ($(dwarf-version-y),5)
> > +DEBUG_CFLAGS += -Wa,-gdwarf-5
>
> I noticed double "-g -gdwarf-5 -g -gdwarf-5" (a different issue) and
> that's why I looked again into the top-level Makefile.

That's...unexpected. I don't see where that could be coming from.
Can you tell me please what is the precise command line invocation of
make and which source file you observed this on so that I can
reproduce?

> Should this be...?
>
> KBUILD_AFLAGS += -Wa,-gdwarf-5

No; under the set of conditions Clang is compiling .c to .S with DWARF
v5 assembler directives. GAS will choke unless told -gdwarf-5 via
-Wa,-gdwarf-5 for .c source files, hence it is a C flag, not an A
flag. A flags are for .S assembler sources, not .c sources.
--
Thanks,
~Nick Desaulniers