Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp874211pxb; Wed, 3 Feb 2021 22:16:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxgEzMP13OanZNT3maHEgm1+oWNsez8oKspnENUAvnfWmcG5HCVVRhlEeVAi3ZZ7HI9WX7i X-Received: by 2002:a50:fb96:: with SMTP id e22mr6392191edq.118.1612419370468; Wed, 03 Feb 2021 22:16:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612419370; cv=none; d=google.com; s=arc-20160816; b=af57WqAucu2haCOZHtpg5+qvccIIMUKhVgktBYD38VIdj8PEkzjycR7/gRSS/Ktgyq VFECSe9SmqFeND3muvTWve8b0PgMvV4sdhOHryiRfm56+xa3wUoEeXZDg5d8TAMos7oi 3INqzRpC+rn5NnjxXX0h+6Qz3SMulCJ24THFatYqdMmzvvzrFJ/KPGP8sptKATtvLJI7 giCmZNWVxxRolEqKNoiJWZsfn2t8vrP2GCK3HTsztEqh969oGawAeDTiwpfemiAR7Lis +QpupJBYic3m7Ofbf9GkmGJ+9ocELeHsAUGTQHaHBjkNDNqthekTcXQJwfUK2Vtmpfwb OJOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=EFWVBuY0De+XPIimdUvHgr/6vnHHJFFofML5VvndojY=; b=GkwlmT/Md95Q8arLHatjBGA0GAkfabfkGyGGmXKgDLrnaEmb7JX04OR/JyRq6tHzDt QAefgxLuYie1tleRfzR/yx+YKHSr04sEzWram741mFg808+FnozG2ZiW4A34POWXipdv MjcmgUogfIBs4dddHOjJ9LSyjMDNxXLqzb6rfoSXPmti535HryMiMN6Q+ewDvzBL+41+ halYC0E5bv8Cqb5I5UsPK5vp43GCTsIDGMK5I5aE2C+mLXtfY14ygNZkplJ67SIlT+Li tvt00BcbearV4+b8LTtIiAWz+AmAhxjof5ZLM/E1STB3pHPe5cCGxIDlX6/y1HJQV/G9 0xVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NY6v3PaH; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si3353517edz.362.2021.02.03.22.15.46; Wed, 03 Feb 2021 22:16:10 -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=@google.com header.s=20161025 header.b=NY6v3PaH; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231910AbhBDGJE (ORCPT + 99 others); Thu, 4 Feb 2021 01:09:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231872AbhBDGI6 (ORCPT ); Thu, 4 Feb 2021 01:08:58 -0500 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A391DC0613ED for ; Wed, 3 Feb 2021 22:08:18 -0800 (PST) Received: by mail-pl1-x62c.google.com with SMTP id x9so1195685plb.5 for ; Wed, 03 Feb 2021 22:08:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=EFWVBuY0De+XPIimdUvHgr/6vnHHJFFofML5VvndojY=; b=NY6v3PaHV/Ef3WPhgaQfSpXZienkPA++dpFxCVWUrn7B4Cdo9/P3gTpD5E56cZj6BC dRs67THC7c64548c3Zp/rIvG2jMFC5eSuxuhlR8/DZXnS4XF1Kwy1y6KJm4OFdLbkI4/ bsJ3bfRAJB9MSM748AM4SS/gpbRPZzFQzhCi1ae2LnuAUMd6JhsGhFWEWSf7FTnJSLLv pqD2mLzWDu6TC13OETXNbNcXaVr52pyxjm7s1ls7JelGUx/Bm6gluGLnPvUGS/hnSdMO UnqqKkk3vuKCPg/7FqWcILjz+oQVUmYi0MCl9L/ohesfaBt2/vFx573ZrrKjtXtaGP/E QnWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=EFWVBuY0De+XPIimdUvHgr/6vnHHJFFofML5VvndojY=; b=JojkeS9ZcXW6Q5XV30sw5RHrKtkBpNmH2PciaKBO87A9UtbPNnjGWXNgWtlEqNYEqT AkXIYSCVEkngnzEAaiGLXcmSd4890/OZWL/Zd4aCAon7rHUF2wcg5InPcBmmSKVj1aUv BGgnLrBggARgEL/P+JsJf7x95BNgZQbnr5TVPblzJp/TQZjr7waUTZI38ctUdcX4gB8p IXghCN93s4OLgWTjmqKzEcirlDepBRDcyueGomC0pKCrDr1grEDuiC1wPqAZHjoZBhbo aYb40c+8+yshj//ps8pPQQyHcm+pltnkdynE3DCxhNXZ9Dqh/dijnEywqIbho8SXu7tM DZOg== X-Gm-Message-State: AOAM5320UGwuHZxqkNtULzXCJ3gtmWS7ebzHK6Hh8N0V5zZMWprKhpmE gXBWMeAD9ymgdANq+oI0xo63DRETfFxp3OFN80tIGA== X-Received: by 2002:a17:902:ed94:b029:de:8844:a650 with SMTP id e20-20020a170902ed94b02900de8844a650mr6790066plj.56.1612418897835; Wed, 03 Feb 2021 22:08:17 -0800 (PST) MIME-Version: 1.0 References: <20210130004401.2528717-1-ndesaulniers@google.com> <20210130004401.2528717-2-ndesaulniers@google.com> <20210130015222.GC2709570@localhost> <20210204033210.ie2a5zuumtlb4jth@google.com> In-Reply-To: <20210204033210.ie2a5zuumtlb4jth@google.com> From: Nick Desaulniers Date: Wed, 3 Feb 2021 22:08:05 -0800 Message-ID: Subject: Re: [PATCH v7 1/2] Kbuild: make DWARF version a choice To: Fangrui Song , Masahiro Yamada Cc: Nathan Chancellor , Nathan Chancellor , Andrew Morton , Sedat Dilek , Linux Kernel Mailing List , clang-built-linux , Linux Kbuild mailing list , linux-arch , Jakub Jelinek , Caroline Tice , Nick Clifton , Yonghong Song , Jiri Olsa , Andrii Nakryiko , Arnaldo Carvalho de Melo , Arvind Sankar Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 3, 2021 at 7:32 PM Fangrui Song wrote: > > On 2021-02-04, Masahiro Yamada wrote: > >On Sat, Jan 30, 2021 at 10:52 AM Nathan Chancellor w= rote: > >> > >> On Fri, Jan 29, 2021 at 04:44:00PM -0800, Nick Desaulniers wrote: > >> > Modifies CONFIG_DEBUG_INFO_DWARF4 to be a member of a choice which i= s > >> > the default. Does so in a way that's forward compatible with existin= g > >> > configs, and makes adding future versions more straightforward. > >> > > >> > GCC since ~4.8 has defaulted to this DWARF version implicitly. > >> > > >> > Suggested-by: Arvind Sankar > >> > Suggested-by: Fangrui Song > >> > Suggested-by: Nathan Chancellor > >> > Suggested-by: Masahiro Yamada > >> > Signed-off-by: Nick Desaulniers > >> > >> One comment below: > >> > >> Reviewed-by: Nathan Chancellor > >> > >> > --- > >> > Makefile | 5 ++--- > >> > lib/Kconfig.debug | 16 +++++++++++----- > >> > 2 files changed, 13 insertions(+), 8 deletions(-) > >> > > >> > diff --git a/Makefile b/Makefile > >> > index 95ab9856f357..d2b4980807e0 100644 > >> > --- a/Makefile > >> > +++ b/Makefile > >> > @@ -830,9 +830,8 @@ ifneq ($(LLVM_IAS),1) > >> > KBUILD_AFLAGS +=3D -Wa,-gdwarf-2 > >> > >> It is probably worth a comment somewhere that assembly files will stil= l > >> have DWARF v2. > > > >I agree. > >Please noting the reason will be helpful. > > > >Could you summarize Jakub's comment in short? > >https://patchwork.kernel.org/project/linux-kbuild/patch/20201022012106.1= 875129-1-ndesaulniers@google.com/#23727667 > > > > > > > > > > > > > >One more question. > > > > > >Can we remove -g option like follows? > > > > > > ifdef CONFIG_DEBUG_INFO_SPLIT > > DEBUG_CFLAGS +=3D -gsplit-dwarf > >-else > >-DEBUG_CFLAGS +=3D -g > > endif > > GCC 11/Clang 12 -gsplit-dwarf no longer imply -g2 > (https://reviews.llvm.org/D80391). May be worth checking whether > -gsplit-dwarf is used without a debug info enabling option. Indeed, I also remember -g was required for -fno-eliminate-unused-debug-types, used by libabigail. https://reviews.llvm.org/D80242 Masahiro, respectfully, I will not touch removing -g in this series. I suspect it will be its own can of worms. > > > > > > > > > > >In the current mainline code, > >-g is the only debug option > >if CONFIG_DEBUG_INFO_DWARF4 is disabled. > > > > > >The GCC manual says: > >https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Debugging-Options.html#Deb= ugging-Options > > > > > >-g > > > > Produce debugging information in the operating system=E2=80=99s > > native format (stabs, COFF, XCOFF, or DWARF). > > GDB can work with this debugging information. > > > > > >Of course, we expect the -g option will produce > >the debug info in the DWARF format. > > > > > > > > > > > >With this patch set applied, it is very explicit. > > > >Only the format type, but also the version. > > > >The compiler will be given either > >-gdwarf-4 or -gdwarf-5, > >making the -g option redundant, I think. > > -gdwarf-N does imply -g2 but personally I'd not suggest remove it if it > already exists. The non-orthogonality is the reason Clang has > -fdebug-default-version (https://reviews.llvm.org/D69822). --=20 Thanks, ~Nick Desaulniers