Re: [PATCH] modpost: Ignore Clang LTO suffixes in symbol matching
Rong Xu <[email protected]>
| Newsgroups | gmane.linux.kbuild.devel,gmane.linux.kernel |
|---|---|
| Message-ID | <CAF1bQ=SEXqObcmmZb4G2g+1pU=WfStho+_n8Mb6KiVWBR5ni7w@mail.gmail.com> |
Petr and Nathan, thanks for the review and suggestions. I will send v2 shortly to implement the more targeted approach. Best regards, Rong On Wed, Jun 17, 2026 at 2:04 PM Nathan Chancellor <[email protected]> wrote: > > 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/[email protected]/ > > > 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