Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Petr Pavlu <petr.pavlu@suse.com>
Cc: "Rong Xu" <xur@google.com>, "Nicolas Schier" <nsc@kernel.org>,
	"Nick Desaulniers" <nick.desaulniers+lkml@gmail.com>,
	"Bill Wendling" <morbo@google.com>,
	"Justin Stitt" <justinstitt@google.com>,
	"Sami Tolvanen" <samitolvanen@google.com>,
	"Siddharth Nayyar" <sidnayyar@google.com>,
	"Josh Poimboeuf" <jpoimboe@kernel.org>,
	"Eric Dumazet" <edumazet@google.com>,
	"René Rebe" <rene@exactco.de>,
	"Alexey Gladkov" <legion@kernel.org>,
	"Johan Hovold" <johan@kernel.org>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev, "kernel test robot" <lkp@intel.com>
Subject: Re: [PATCH] modpost: Ignore Clang LTO suffixes in symbol matching
Date: Wed, 17 Jun 2026 14:04:10 -0700	[thread overview]
Message-ID: <20260617210410.GA3894029@ax162> (raw)
In-Reply-To: <71a166bc-06c9-4a84-b61b-6b0d7c6c6585@suse.com>

On Wed, Jun 17, 2026 at 12:48:10PM +0200, Petr Pavlu wrote:
> On 6/16/26 12:43 AM, Rong Xu wrote:
> > A more direct fix for the warnings in
> > https://lore.kernel.org/oe-kbuild-all/202606111233.kM8oo8Df-lkp@intel.com/
> > looks like the following. But I believe the solution provided in the
> > patch is more comprehensive.
> > 
> > -Rong
> > 
> > ======
> > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> > index abbcd3fc1394..1f0a379b43c8 100644
> > --- a/scripts/mod/modpost.c
> > +++ b/scripts/mod/modpost.c
> > @@ -967,7 +967,7 @@ static int secref_whitelist(const char *fromsec,
> > const char *fromsym,
> >         /* symbols in data sections that may refer to any init/exit sections */
> >         if (match(fromsec, PATTERNS(DATA_SECTIONS)) &&
> >             match(tosec, PATTERNS(ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS)) &&
> > -           match(fromsym, PATTERNS("*_ops", "*_console")))
> > +           match(fromsym, PATTERNS("*_ops", "*_ops.llvm.*", "*_console")))
> >                 return 0;
> > 
> >         /* Check for pattern 3 */
> > 
> 
> This variant makes more sense to me. The initially proposed patch
> modifies the match() function, which is a generic function to check
> whether a string matches any of the input patterns. The modpost utility
> uses it to match both symbol and section names. Adding symbol-specific
> knowledge to this function seems odd.

Yeah, I had the feeling that it was a bit of a layering violation as
well. I think I would prefer this targeted fix for now since I will take
it as a fix for 7.2 in my planned second Kbuild pull request. We can
revisit the more comprehensive fix if it is needed in the future (while
seeing if we can address it outside of match() regardless).

> I noticed that LLVM has recently made improvements to reduce the number
> of these ThinLTO renames [1], which might be worth checking out.
> 
> [1] https://github.com/llvm/llvm-project/commit/975dba28633d2f3746a8a370741b17024b0f5f9b

Indeed, we have started using that for regular ThinLTO when it is
available as of commit dc3b90751d6f ("kbuild: Reduce the number of
compiler-generated suffixes for clang thin-lto build"). Distributed
ThinLTO support will follow when LLVM 23.1.0 is released.

-- 
Cheers,
Nathan

  reply	other threads:[~2026-06-17 21:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15 22:20 [PATCH] modpost: Ignore Clang LTO suffixes in symbol matching xur
2026-06-15 22:43 ` Rong Xu
2026-06-17 10:48   ` Petr Pavlu
2026-06-17 21:04     ` Nathan Chancellor [this message]
2026-06-17 21:41       ` Rong Xu

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=20260617210410.GA3894029@ax162 \
    --to=nathan@kernel.org \
    --cc=edumazet@google.com \
    --cc=johan@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=justinstitt@google.com \
    --cc=legion@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=nsc@kernel.org \
    --cc=petr.pavlu@suse.com \
    --cc=rene@exactco.de \
    --cc=samitolvanen@google.com \
    --cc=sidnayyar@google.com \
    --cc=xur@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox