From: Yonghong Song <yonghong.song@linux.dev>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
linux-kbuild@vger.kernel.org, live-patching@vger.kernel.org,
kernel-team@fb.com, Nicolas Schier <nsc@kernel.org>,
Song Liu <song@kernel.org>
Subject: Re: [PATCH kbuild] kbuild: Allow to reduce the number of suffixes for clang thin-lto build
Date: Fri, 6 Mar 2026 21:14:56 -0800 [thread overview]
Message-ID: <22f5c641-f472-4fe9-aec5-a660efbfdd5e@linux.dev> (raw)
In-Reply-To: <20260306224522.GA2746259@ax162>
On 3/6/26 2:45 PM, Nathan Chancellor wrote:
> On Fri, Mar 06, 2026 at 02:12:44PM -0800, Yonghong Song wrote:
>> So you mean we do not need a new config. Should just check clang and
>> clang versionn like below?
>>
>> diff --git a/Makefile b/Makefile
>> index e944c6e71e81..9bd3990024c5 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -1034,6 +1034,11 @@ endif
>> ifdef CONFIG_LTO_CLANG
>> ifdef CONFIG_LTO_CLANG_THIN
>> CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit
>> +ifdef CONFIG_CC_IS_CLANG
>> +ifeq ($(shell test $(CONFIG_CLANG_VERSION) -ge 230000; echo $$?),0)
> This is the same as
>
> ifeq ($(call clang-min-version,230000),y)
>
> That being said, could we not just do a dynamic check so that it always
> works when these flags are supported?
Thanks for the suggestion! What you had below with 'call ld-option' is perfect
to satisfy this requirement: <= llvm22, two flags will be ignored, and
>= llvm23, two flags will be used.
v2: https://lore.kernel.org/linux-kbuild/20260307050250.3767489-1-yonghong.song@linux.dev/
>
>> +KBUILD_LDFLAGS += --lto-whole-program-visibility -mllvm -always-rename-promoted-locals=false
> KBUILD_LDFLAGS += $(call ld-option,--lto-whole-program-visibility -mllvm -always-rename-promoted-locals=false)
>
>> +endif
>> +endif
>> else
>> CC_FLAGS_LTO := -flto
>> endif
>>
>> I think this should work. In rare case, renaming the function should
>> solve the problem.
> I agree with Josh that having this be the default behavior with the
> workarounds that we have available to us to avoid problems from it is
> worth it. Thanks for chasing this after the discussions at LPC.
>
> Cheers,
> Nathan
prev parent reply other threads:[~2026-03-07 5:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 3:43 [PATCH kbuild] kbuild: Allow to reduce the number of suffixes for clang thin-lto build Yonghong Song
2026-03-06 18:32 ` Josh Poimboeuf
2026-03-06 19:40 ` Yonghong Song
2026-03-06 20:54 ` Josh Poimboeuf
2026-03-06 20:57 ` Josh Poimboeuf
2026-03-06 22:12 ` Yonghong Song
2026-03-06 22:45 ` Nathan Chancellor
2026-03-07 5:14 ` Yonghong Song [this message]
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=22f5c641-f472-4fe9-aec5-a660efbfdd5e@linux.dev \
--to=yonghong.song@linux.dev \
--cc=jpoimboe@kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=song@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox