All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Dmitrii Bundin <dmitrii.bundin.a@gmail.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Eric Dumazet <edumazet@google.com>,
	Isabella Basso <isabbasso@riseup.net>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Fangrui Song <maskray@google.com>,
	Michal Marek <michal.lkml@markovi.net>,
	Nathan Chancellor <nathan@kernel.org>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH v3] kbuild: add debug level and macro defs options
Date: Fri, 30 Sep 2022 06:06:46 +0900	[thread overview]
Message-ID: <CAK7LNATeW+c5+Kxnj9M4N+yNSv+7ot7bLTHzO3Z0Xb_XEW_6Nw@mail.gmail.com> (raw)
In-Reply-To: <CANXV_XzdTTYc2w7Ur8zY=ijOofg91yfF7RLhedbVH0rmi3c2yA@mail.gmail.com>

On Tue, Aug 23, 2022 at 7:42 AM Dmitrii Bundin
<dmitrii.bundin.a@gmail.com> wrote:
>
> On Tue, Aug 23, 2022 at 12:36 AM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
> >
> > or perhaps that simply needs to be `-g -gsplit-dwarf`?  In which case,
> > that if/else could just be re-arranged.
>
> How about simply assigning DEBUG_CFLAGS   := -g at the very beginning
> without any conditions? This would provide the default with the
> possibility of overriding later and -gsplit-dwarf does not necessarily
> come with -g implicitly.

This was fixed by commit 32ef9e5054ec0321b9336058c58ec749e9c6b0fe,
which is now in the mainline.




> > Honestly, I really don't think we need to be wrapping every compiler
> > command line flag under the sun in a kconfig option.
>
> This indeed sounds reasonable to me. So the key point here is to not
> bloat the kconfig with options related to every compiler flag. But I
> think it still might be useful to provide some option that would
> include sort of full debug information compilers may produce. With
> this approach there would be, in fact 3 different levels of debug
> information supported by Kconfig: reduced, default and full. The full
> level would increase everything like -g3, and -fdebug-macro for Clang,
> and probably others.


I think that would be much saner than this patch.



CONFIG_DEBUG_INFO_LEVEL is a direct way to specify the debug level.

CONFIG_DEBUG_MACRO_DEFINITIONS is feature-driven.

Do not mix two different ways.






CONFIG_DEBUG_INFO_LEVEL is here just because Andrew Morton suggested that.


The debug level is compiler-specific. There is no guarantee
that there is a common range.


The debug level range of GCC is 0-3.
Clang accepts 3, but -g3 has no effect.
The debug level range of Rustc is 0-2.

See how badly scripts/Makefile.debug looks in linux-next.





How should Rustc behave for CONFIG_DEBUG_INFO_LEVEL=3 ?

-Cdebuginfo=3 is a compile error.

  RUSTC L rust/core.o
error: debug info level needs to be between 0-2 (instead was `3`)



You cannot directly specify the debug level number given that
we support multiple compilers with different policy for
debug level options.






> > Or add -g1 to CONFIG_DEBUG_INFO_REDUCED.
>
> I ran some tests and there was indeed some decrease in size. That
> combination probably might be useful.
>
> Any thoughts?
>
> Regards
> Dmitrii





-- 
Best Regards
Masahiro Yamada

  parent reply	other threads:[~2022-09-29 21:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-14  0:20 [PATCH v2] kbuild: add configurable debug info level Dmitrii Bundin
2022-08-14  2:01 ` Masahiro Yamada
2022-08-14  5:31   ` Fangrui Song
2022-08-14 18:58     ` Masahiro Yamada
2022-08-14 19:17     ` Dmitrii Bundin
2022-08-15  1:33       ` [PATCH v3] kbuild: add debug level and macro defs options Dmitrii Bundin
2022-08-18  4:13         ` Masahiro Yamada
2022-08-18 18:57           ` Dmitrii Bundin
2022-08-19 17:42         ` Nick Desaulniers
2022-08-19 22:52           ` Dmitrii Bundin
2022-08-22 16:45             ` Nick Desaulniers
2022-08-22 21:36               ` Nick Desaulniers
2022-08-22 22:42                 ` Dmitrii Bundin
2022-08-24 23:25                   ` Nick Desaulniers
2022-09-29 21:06                   ` Masahiro Yamada [this message]
2022-09-30  9:11                     ` Masahiro Yamada
2022-10-08  7:24                       ` Dmitrii Bundin
2022-08-23  6:06             ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK7LNATeW+c5+Kxnj9M4N+yNSv+7ot7bLTHzO3Z0Xb_XEW_6Nw@mail.gmail.com \
    --to=masahiroy@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=dmitrii.bundin.a@gmail.com \
    --cc=edumazet@google.com \
    --cc=isabbasso@riseup.net \
    --cc=jpoimboe@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=maskray@google.com \
    --cc=michal.lkml@markovi.net \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.