From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08301C63777 for ; Mon, 30 Nov 2020 18:12:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 811FE2074A for ; Mon, 30 Nov 2020 18:12:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nifty.com header.i=@nifty.com header.b="M/a6eVu8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729513AbgK3SMT (ORCPT ); Mon, 30 Nov 2020 13:12:19 -0500 Received: from condef-10.nifty.com ([202.248.20.75]:24017 "EHLO condef-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726614AbgK3SMT (ORCPT ); Mon, 30 Nov 2020 13:12:19 -0500 Received: from conssluserg-01.nifty.com ([10.126.8.80])by condef-10.nifty.com with ESMTP id 0AUI6Ypn012440 for ; Tue, 1 Dec 2020 03:06:34 +0900 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (authenticated) by conssluserg-01.nifty.com with ESMTP id 0AUI5Udq000564; Tue, 1 Dec 2020 03:05:30 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com 0AUI5Udq000564 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1606759531; bh=Uh4bIgW4sNgrSBi12OkKecL/ZclO6A0g1hh7lFN2Jko=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=M/a6eVu8pHfFZeJlahUIEmCpqOBR2YwmkiKpa56CXrbjGlXbIVh/q/cGzHEl3y3JZ b95udOb7WzeBSgoG8f7b76dQbQl4Lm0zZYH5+ogoUgxgQ3LOjeZumQakqWqE6m+e0E mkItlKcl60ANX+oZNbtbOlsFQ4rACo78+89E6QoJ21IgsYIwkVucRJPA8yYHX6D73j jTwa4KrSiojCFHzW/teMheezkj3C9Ffy75427zvfI15YkhCbfF58tLJJ8tyGigjsgF /9obuBZrJZBa4GldoK8tlPDhg597z8MJ5HmRCSF9btfUkULRqVo7W6Ru8OapEbj6NI BB8D1wBQY03DQ== X-Nifty-SrcIP: [209.85.216.44] Received: by mail-pj1-f44.google.com with SMTP id r9so48722pjl.5; Mon, 30 Nov 2020 10:05:30 -0800 (PST) X-Gm-Message-State: AOAM531cD/b1W4+wxeZofTX0pUDqlrNead1peZYYsWUyhW15xz4mP7A5 t79Fsl4/uSHaSAxyl9lizWhtd89fCD2SbejoZk0= X-Google-Smtp-Source: ABdhPJw1yBQ+OjoG4aqEDV/okFiCVTmc526vsm2/CdKpMW7Nxrp9CZ6Z2BiW9LeBm1Bo+suMp+4xSEhr/ZXxP5MUjHg= X-Received: by 2002:a17:90a:c209:: with SMTP id e9mr27829261pjt.87.1606759529929; Mon, 30 Nov 2020 10:05:29 -0800 (PST) MIME-Version: 1.0 References: <20201104005343.4192504-1-ndesaulniers@google.com> <20201104005343.4192504-4-ndesaulniers@google.com> In-Reply-To: <20201104005343.4192504-4-ndesaulniers@google.com> From: Masahiro Yamada Date: Tue, 1 Dec 2020 03:04:50 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 3/4] Kbuild: make DWARF version a choice To: Nick Desaulniers Cc: Jakub Jelinek , Linux Kbuild mailing list , Linux Kernel Mailing List , linux-toolchains@vger.kernel.org, clang-built-linux , Fangrui Song , Nathan Chancellor , Sedat Dilek , Dmitry Golovin , Alistair Delva Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org On Wed, Nov 4, 2020 at 9:53 AM 'Nick Desaulniers' via Clang Built Linux 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 > Suggested-by: Masahiro Yamada > Signed-off-by: Nick Desaulniers > --- > 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) This changes the behavior. For the Dwarf-2 case, Previously, -gdwarf-2 was passed to $(CC), so the debug info was generated by gcc. Now, -Wa,-gdwarf-2 is passed to $(CC). -gdwarf-2 is handled by GNU as. So, the source info points to /tmp/.s instead of the original .c file. Handling the Dwarf capability is very complicated. Are you still working for v3? > +KBUILD_AFLAGS += $(dwarf-aflag) > endif > > ifdef CONFIG_DEBUG_INFO_REDUCED > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > index 83a860126897..03c494eefabd 100644 > --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -256,14 +256,25 @@ config DEBUG_INFO_SPLIT > to know about the .dwo files and include them. > Incompatible with older versions of ccache. > > +choice > + prompt "DWARF version" > + help > + Which version of DWARF debug info to emit. > + > +config DEBUG_INFO_DWARF2 > + bool "Generate DWARF v2 debuginfo" > + help > + Generate DWARF v2 debug info. > + > config DEBUG_INFO_DWARF4 > bool "Generate dwarf4 debuginfo" > depends on $(cc-option,-gdwarf-4) > help > - Generate dwarf4 debug info. This requires recent versions > - of gcc and gdb. It makes the debug information larger. > - But it significantly improves the success of resolving > - variables in gdb on optimized code. > + Generate DWARF v4 debug info. This requires gcc 4.5+ and gdb 7.0+. > + It makes the debug information larger, but it significantly > + improves the success of resolving variables in gdb on optimized code. > + > +endchoice # "DWARF version" > > config DEBUG_INFO_BTF > bool "Generate BTF typeinfo" > -- > 2.29.1.341.ge80a0c044ae-goog > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20201104005343.4192504-4-ndesaulniers%40google.com. -- Best Regards Masahiro Yamada