[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201123232210.GA208735@rani.riverdale.lan>
Date: Mon, 23 Nov 2020 18:22:10 -0500
From: Arvind Sankar <nivedita@...m.mit.edu>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Masahiro Yamada <masahiroy@...nel.org>,
Jakub Jelinek <jakub@...hat.com>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-toolchains@...r.kernel.org,
clang-built-linux <clang-built-linux@...glegroups.com>,
Fangrui Song <maskray@...gle.com>,
Nathan Chancellor <natechancellor@...il.com>,
Sedat Dilek <sedat.dilek@...il.com>,
Dmitry Golovin <dima@...ovin.in>,
Alistair Delva <adelva@...gle.com>
Subject: Re: [PATCH v2 3/4] Kbuild: make DWARF version a choice
On Tue, Nov 03, 2020 at 04:53:42PM -0800, Nick Desaulniers wrote:
> Modifies CONFIG_DEBUG_INFO_DWARF4 to be a member of a choice. Adds an
> explicit CONFIG_DEBUG_INFO_DWARF2, which is the default. Does so in a
> way that's forward compatible with existing configs, and makes adding
> future versions more straightforward.
>
> Suggested-by: Fangrui Song <maskray@...gle.com>
> Suggested-by: Masahiro Yamada <masahiroy@...nel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
> ---
> Makefile | 14 ++++++++------
> lib/Kconfig.debug | 19 +++++++++++++++----
> 2 files changed, 23 insertions(+), 10 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 75b1a3dcbf30..e23786a4c1c7 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -826,12 +826,14 @@ else
> DEBUG_CFLAGS += -g
> endif
>
> -ifndef LLVM_IAS
> -KBUILD_AFLAGS += -Wa,-gdwarf-2
> -endif
> -
> -ifdef CONFIG_DEBUG_INFO_DWARF4
> -DEBUG_CFLAGS += -gdwarf-4
> +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2
> +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
> +DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
> +ifneq ($(dwarf-version-y)$(LLVM_IAS),21)
> +# Binutils 2.35+ required for -gdwarf-4+ support.
> +dwarf-aflag := $(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y))
> +DEBUG_CFLAGS += $(dwarf-aflag)
> +KBUILD_AFLAGS += $(dwarf-aflag)
> endif
>
For LLVM_IAS=1, adding dwarf-aflag to DEBUG_CFLAGS should not be
necessary, no? This seems to add it for dwarf-4.
The as-option check will only work on binutils 2.35.1 onwards: earlier
versions will silently accept any -gdwarf-N option. Do we care? I think
it'll just get dwarf-2 for assembly files even though dwarf-4 might have
been configured. The earlier versions only error if the double-hyphen
form --gdwarf-N is used.
More generally, do we want to force this option via -Wa or should we
leave it up to the compiler driver when we can? For both Clang/IAS and
gcc/binutils, passing -gdwarf-N in KBUILD_AFLAGS will allow the compiler
to pass on the appropriate option to the assembler (with gcc you only
get --gdwarf-2 for the assembler except on trunk though). The only case
that would absolutely require -Wa is Clang without IAS, might be worth
adding the ability to pass on the flag to the external assembler?
Btw, is -gsplit-dwarf at all useful for assembler files?
Powered by blists - more mailing lists