Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3784805pxu; Mon, 30 Nov 2020 10:10:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzuG85h2HJUXco9AUKd2ICAXWGFpVjGZwLfQdytL6nnasZeXxMI1GlVbIIJjqozirXU6qRc X-Received: by 2002:a17:906:1f44:: with SMTP id d4mr14396237ejk.368.1606759807612; Mon, 30 Nov 2020 10:10:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606759807; cv=none; d=google.com; s=arc-20160816; b=A+HlG86iRGpJXUYqIt8mkNxZBpXeMkC+4gfUWpFDueN2dT2+YfG4fqxf05W6sa7uaK mY/e0rG8ZN7viTaOzDXwFjclbc/ndh6nVcMBuxFsMyGzLAgXJILuJaBHh0z6s+Z1/2rI +lC0ksUiX7fACvftFGliCgc4ytDSHOitebhqC84H4qmuzDoO1ixA5M1zD8j22eLwkBex UQfdgNhF+7hNNIZdkWUUaWojjEanhooUi4Rm2VY3+jrJZ58VpHgp7m1oHHlgnUOGEd0d v8AFHyUekW6lDc3BHSvfSnX+uJouRCwLomYPqyAhPRzKyQfWhS/bTlOLvOTJCynNpn1C 4y0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=Uh4bIgW4sNgrSBi12OkKecL/ZclO6A0g1hh7lFN2Jko=; b=YtWt1D0DChc+QZb7HoV+RTXHzyiiM5qGSE6IwNeLqhFCwgC9n7+HlnCok4sGdcfKbr HCjC46miGsV3ivtHPlQ4F+/ocAV6z/6To30jMdiraWnaHYee/QyOwM3nCeLzqf4x5JYR 9h24FGRQqh+7rKeE6PPFA+OjfIiwpE2KjDljBMXww+MfV92webahbkQvQHJyOmfVU0Dz Ldde3aHQlA02SVKDntuiGoplLcCnuMfFb8j5DjaNXVWrvS5TidskeqDmZE09fE4I4emv m9XK1GQjywTfw6w35vRyBhcBUCYXbA0stJhObOXFGj90CztlqIWieTuTk1EkcPzGKn3h ZlUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="M/a6eVu8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z21si11562012edx.510.2020.11.30.10.09.43; Mon, 30 Nov 2020 10:10:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="M/a6eVu8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729541AbgK3SGf (ORCPT + 99 others); Mon, 30 Nov 2020 13:06:35 -0500 Received: from conssluserg-01.nifty.com ([210.131.2.80]:28492 "EHLO conssluserg-01.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728359AbgK3SGe (ORCPT ); Mon, 30 Nov 2020 13:06:34 -0500 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-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-kernel@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