From: Nathan Chancellor <nathan@kernel.org>
To: Borislav Petkov <bp@alien8.de>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org,
Petr Mladek <pmladek@suse.com>,
Joe Lawrence <joe.lawrence@redhat.com>,
x86@kernel.org
Subject: Re: [tip: objtool/core] objtool/klp: Add --debug option to show cloning decisions
Date: Fri, 31 Oct 2025 10:09:44 -0400 [thread overview]
Message-ID: <20251031140944.GA3022331@ax162> (raw)
In-Reply-To: <20251031114919.GBaQSiPxZrziOs3RCW@fat_crate.local>
Hey Boris,
On Fri, Oct 31, 2025 at 12:49:19PM +0100, Borislav Petkov wrote:
> On Thu, Oct 16, 2025 at 09:52:15AM -0000, tip-bot2 for Josh Poimboeuf wrote:
> > The following commit has been merged into the objtool/core branch of tip:
> >
> > Commit-ID: 7c2575a6406fb85946b05d8dcc856686d3156354
> > Gitweb: https://git.kernel.org/tip/7c2575a6406fb85946b05d8dcc856686d3156354
> > Author: Josh Poimboeuf <jpoimboe@kernel.org>
> > AuthorDate: Wed, 17 Sep 2025 09:04:00 -07:00
> > Committer: Josh Poimboeuf <jpoimboe@kernel.org>
> > CommitterDate: Tue, 14 Oct 2025 14:50:18 -07:00
> >
> > objtool/klp: Add --debug option to show cloning decisions
> >
> > Add a --debug option to klp diff which prints cloning decisions and an
> > indented dependency tree for all cloned symbols and relocations. This
> > helps visualize which symbols and relocations were included and why.
> >
> > Acked-by: Petr Mladek <pmladek@suse.com>
> > Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
> > Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> > ---
>
> ...
>
> > +#define dbg_indent(args...) \
> > + int __attribute__((cleanup(unindent))) __dummy_##__COUNTER__; \
>
> so this compiler:
>
> Ubuntu clang version 15.0.7
>
> doesn't like this, see below. With some configs only, I've attached one.
>
> Newer clang is fine so I guess this old one which we support can't do that
> unused var squashing or so.
Correct, I fixed this in clang-17 so clang-15 and clang-16 will show
this.
https://github.com/llvm/llvm-project/commit/877210faa447f4cc7db87812f8ed80e398fedd61
> How about this fix?
Yeah, that looks good to me and matches the workaround that Peter did in
include/linux/compiler-clang.h. If cleanup is going to be used more in
objtool, it might be worth taking that approach there too like:
#ifdef __clang__
#define __cleanup(func) __maybe_unused __attribute__((__cleanup__(func)))
#else
#define __cleanup(func) __attribute__((__cleanup__(func)))
#endif
> Seems to work here.
>
> ---
>
> diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/objtool/warn.h
> index e88322d97573..289fbce428c5 100644
> --- a/tools/objtool/include/objtool/warn.h
> +++ b/tools/objtool/include/objtool/warn.h
> @@ -127,7 +127,7 @@ static inline void unindent(int *unused) { indent--; }
> })
>
> #define dbg_indent(args...) \
> - int __attribute__((cleanup(unindent))) __dummy_##__COUNTER__; \
> + int __attribute__((cleanup(unindent))) __used __dummy_##__COUNTER__; \
> __dbg_indent(args); \
> indent++
>
> ---
>
> build error:
>
> ---
>
> klp-diff.c:601:2: error: unused variable '__dummy___COUNTER__' [-Werror,-Wunused-variable]
> dbg_indent("%s%s", patched_sym->name, data_too ? " [+DATA]" : "");
> ^
> /home/amd/kernel/linux/tools/objtool/include/objtool/warn.h:130:41: note: expanded from macro 'dbg_indent'
> int __attribute__((cleanup(unindent))) __dummy_##__COUNTER__; \
> ^
> <scratch space>:132:1: note: expanded from here
> __dummy___COUNTER__
> ^
> klp-diff.c:1045:2: error: unused variable '__dummy___COUNTER__' [-Werror,-Wunused-variable]
> dbg_clone_reloc(sec, offset, patched_sym, addend, export, klp);
> ^
> klp-diff.c:1016:2: note: expanded from macro 'dbg_clone_reloc'
> dbg_indent("%s+0x%lx: %s%s0x%lx [%s%s%s%s%s%s]", \
> ^
> /home/amd/kernel/linux/tools/objtool/include/objtool/warn.h:130:41: note: expanded from macro 'dbg_indent'
> int __attribute__((cleanup(unindent))) __dummy_##__COUNTER__; \
> ^
> <scratch space>:138:1: note: expanded from here
> __dummy___COUNTER__
> ^
Cheers,
Nathan
next prev parent reply other threads:[~2025-10-31 14:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-16 9:52 [tip: objtool/core] objtool/klp: Add --debug option to show cloning decisions tip-bot2 for Josh Poimboeuf
2025-10-31 11:49 ` Borislav Petkov
2025-10-31 14:09 ` Nathan Chancellor [this message]
2025-10-31 14:21 ` Borislav Petkov
2025-10-31 16:11 ` Josh Poimboeuf
2025-10-31 20:25 ` Nathan Chancellor
2025-11-01 12:44 ` [PATCH] tools/objtool: Copy the __cleanup unused variable fix for older clang Borislav Petkov
2025-11-01 16:43 ` Nathan Chancellor
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=20251031140944.GA3022331@ax162 \
--to=nathan@kernel.org \
--cc=bp@alien8.de \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=x86@kernel.org \
/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.