Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3205351rwb; Mon, 3 Oct 2022 11:11:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4e4zati9bo0JRQRJ7QCyPaNF8Y4+nD+PlVh0FxVFY/hePvppLCxzoQkRu0VKEEKGARydEF X-Received: by 2002:a17:903:2cd:b0:179:cf09:4d8a with SMTP id s13-20020a17090302cd00b00179cf094d8amr23464576plk.107.1664820667073; Mon, 03 Oct 2022 11:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664820667; cv=none; d=google.com; s=arc-20160816; b=viC3Z2VhXrNvRSu6qcWldg1GBW5r/+Tj8HSSi8b2OUHquMmP92VCl3QCPZkWHpIXsP FB7pjJKa3IuLhFKgrAjTqQS8eef6tOJDgjp+cS6J90cARGt3zDyQjoAZDoiLWEq+xbn+ IohomI/qfY9E9LHxI+zFGY79b5AGHtgbpww5N0e5hsqNy4u717Aa7ahP8ySZb/Rolzcf 4OICXmm5Abt4bUDqAdX4EABHRP0g4jLLMjWADFyuR1c4XLuOOK0dSLxNPsdBWis8G0vi 0XnNdd1vhsOTNq4dU9MWCrDE8WxF0FJoaW4vKU21jg0eN4sLkmWLY5RD/lQmb+kFtl7i Rjeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+1wuFTwGXP4ww0QPPbBye8m9NmC1TedTWtP71vvOVbk=; b=hFbPg5w+SnF0vzM4g3RMUMVWNGtvQwQrRmoKw04XiW0ref6t/JFATbjmTs18O72VSN VWwuKIMtQ8AkKfUzqd4HDB58foADjlmfO3ZuzhxniXeuNghysINIid2/xejTIlDPkiiI ab5JWcBW+u7qPR/gZnLBoKe/P+lGv9I1OfP1ub6TEwz4Twbf9MkF21xOg/OiOkWCF4RP 7cPuCM3gcIgxU80ql4ugUHGIYb2QkRHRAR1ojvNxykpJcHwcITYomNHFc0RQpvrsOyLV 9Q5lYJOr5VJhQblCooCIsP3ewCK3tX3gpDLzGMm6LQNpLgNwnmdgeq8sFtBCwwKGs32n f0Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fxyTqpSu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 71-20020a63014a000000b004519a9e15cfsi2115007pgb.857.2022.10.03.11.10.55; Mon, 03 Oct 2022 11:11:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fxyTqpSu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229676AbiJCRUX (ORCPT + 99 others); Mon, 3 Oct 2022 13:20:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbiJCRUU (ORCPT ); Mon, 3 Oct 2022 13:20:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C61FD1AF0E; Mon, 3 Oct 2022 10:20:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6BECE60FA8; Mon, 3 Oct 2022 17:20:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A3B3C433C1; Mon, 3 Oct 2022 17:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664817616; bh=CqZMJfdEljuMYZz99/OJQk9Jg5oI7uCfP2nJ0LqL300=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fxyTqpSuDAjJWIWx3yTPuqp6qOrbj68hHEhCY2v8aTDqq3dYF/WZqXMw2famWQTU1 lUIC3U+A6hRBcl0xs7DconznDcWdxELy7cqIlDQtl2eflxu2dLNpf71JiHaiTEeM28 8qYhkWbMsJdyfd8UoCtGKgmL1iLpjoC4EdnZj0Dy8t9+5nNK6meCmpyXINBSuBx+Ej 4KC45Z1hxCvksbqTrghEqs4dhhlZYpknby2VEZmnsy/6RuaGRQtmXoJUN3RhPhkDyr BLpGoLRyQ7DVrTx6geWoRLjMFPLJMi0HLnsoDuClJWNeYjuwfdkEcSbBx6W+Wg1xRK EXjQT8bXk6vtg== Date: Mon, 3 Oct 2022 10:20:14 -0700 From: Nathan Chancellor To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Nick Desaulniers , Miguel Ojeda Subject: Re: [PATCH 3/3] Kconfig.debug: split debug-level and DWARF-version into separate choices Message-ID: References: <20221002181107.51286-1-masahiroy@kernel.org> <20221002181107.51286-4-masahiroy@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221002181107.51286-4-masahiroy@kernel.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 03, 2022 at 03:11:07AM +0900, Masahiro Yamada wrote: > Commit f9b3cd245784 ("Kconfig.debug: make DEBUG_INFO selectable from > a choice") added CONFIG_DEBUG_INFO_NONE into the DWARF version choice, > but it should rather belong to the debug level choice. > > This commit consolidates CONFIG options into two choices: > > - Debug info level (NONE / REDUCED / DEFAULT) > > - DWARF format (DWARF_TOOLCHAIN_DEFAULT / DWARF4 / DWARF5) > > This is more consistent with compilers' policy because the -g0 compiler > flag means "no debug info". > > GCC manual: > > -g > > Request debugging information and also use level to specify how > much information. The default level is 2. > > Level 0 produces no debug information at all. Thus, -g0 negates -g. > > Level 1 produces minimal information, enough for making backtraces > in parts of the program that you don’t plan to debug. This includes > descriptions of functions and external variables, and line number > tables, but no information about local variables. > > Level 3 includes extra information, such as all the macro > definitions present in the program. Some debuggers support macro > expansion when you use -g3. > > Rustc Codegen manual: > > debuginfo > > This flag controls the generation of debug information. It takes > one of the following values: > > 0: no debug info at all (the default). > 1: line tables only. > 2: full debug info. > > I moved CONFIG_DEBUG_INFO_REDUCED into the debug level choice. > > This change will make it easier to add another debug info level if > necessary. > > Signed-off-by: Masahiro Yamada > Reviewed-by: Nick Desaulniers > Acked-by: Miguel Ojeda As far as I can tell, this will require updating defconfigs again to include an explicit 'CONFIG_DEBUG_INFO_DEFAULT=y', right? It might be nice to do that as part of this change to keep everything working, as there was some fallout from the last time: 92f89ec1b534 ("powerpc: Restore CONFIG_DEBUG_INFO in defconfigs") ddd366bf01de ("ARM: defconfig: address renamed CONFIG_DEBUG_INFO=y") Regardless, I think this is a good change. Reviewed-by: Nathan Chancellor > --- > > lib/Kconfig.debug | 59 +++++++++++++++++++++++++++++------------------ > 1 file changed, 36 insertions(+), 23 deletions(-) > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > index cc90414d492e..ce1faae1a979 100644 > --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -234,15 +234,10 @@ config DEBUG_INFO > choice > prompt "Debug information" > depends on DEBUG_KERNEL > + depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502) > help > Selecting something other than "None" results in a kernel image > that will include debugging info resulting in a larger kernel image. > - This adds debug symbols to the kernel and modules (gcc -g), and > - is needed if you intend to use kernel crashdump or binary object > - tools like crash, kgdb, LKCD, gdb, etc on the kernel. > - > - Choose which version of DWARF debug info to emit. If unsure, > - select "Toolchain default". > > config DEBUG_INFO_NONE > bool "Disable debug information" > @@ -250,10 +245,40 @@ config DEBUG_INFO_NONE > Do not build the kernel with debugging information, which will > result in a faster and smaller build. > > +config DEBUG_INFO_REDUCED > + bool "Reduced debugging information" > + select DEBUG_INFO > + help > + If you say Y here compiler is instructed to generate less debugging > + information for structure types. This means that tools that > + need full debugging information (like kgdb or systemtap) won't > + be happy. But if you merely need debugging information to > + resolve line numbers there is no loss. Advantage is that > + build directory object sizes shrink dramatically over a full > + DEBUG_INFO build and compile times are reduced too. > + Only works with newer gcc versions. > + > +config DEBUG_INFO_DEFAULT > + bool "Default-level debugging information" > + select DEBUG_INFO > + help > + If you say Y here compiler is instructed to generate the default > + level of debugging information. > + > + This adds debug symbols to the kernel and modules (gcc -g), and > + is needed if you intend to use kernel crashdump or binary object > + tools like crash, kgdb, LKCD, gdb, etc on the kernel. > + > +endchoice # "Debug information" > + > +choice > + prompt "DWARF version" > + depends on DEBUG_INFO > + help > + Which version of DWARF debug info to emit. > + > config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT > bool "Rely on the toolchain's implicit default DWARF version" > - select DEBUG_INFO > - depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502) > help > The implicit default version of DWARF debug info produced by a > toolchain changes over time. > @@ -262,9 +287,10 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT > support newer revisions, and prevent testing newer versions, but > those should be less common scenarios. > > + If unsure, say Y. > + > config DEBUG_INFO_DWARF4 > bool "Generate DWARF Version 4 debuginfo" > - select DEBUG_INFO > depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) > help > Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2 > @@ -276,7 +302,6 @@ config DEBUG_INFO_DWARF4 > > config DEBUG_INFO_DWARF5 > bool "Generate DWARF Version 5 debuginfo" > - select DEBUG_INFO > depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) > help > Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc > @@ -291,22 +316,10 @@ config DEBUG_INFO_DWARF5 > config if they rely on tooling that has not yet been updated to > support DWARF Version 5. > > -endchoice # "Debug information" > +endchoice # "DWARF version" > > if DEBUG_INFO > > -config DEBUG_INFO_REDUCED > - bool "Reduce debugging information" > - help > - If you say Y here gcc is instructed to generate less debugging > - information for structure types. This means that tools that > - need full debugging information (like kgdb or systemtap) won't > - be happy. But if you merely need debugging information to > - resolve line numbers there is no loss. Advantage is that > - build directory object sizes shrink dramatically over a full > - DEBUG_INFO build and compile times are reduced too. > - Only works with newer gcc versions. > - > config DEBUG_INFO_COMPRESSED > bool "Compressed debugging information" > depends on $(cc-option,-gz=zlib) > -- > 2.34.1 >