From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9679311597 for ; Sat, 7 Mar 2026 05:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772860513; cv=none; b=mbGQKaK3R3AK2nmU2NAqFq3mN/TM+FKFfK7fyRArLOah4505gP/KztgnkYgAPnyWymoD8AOiXnosuOktOTH1Y0yhux4C3BDRSHELIz6aOLS1zwj7m2mg/wnZ56udZYWLgPTh5YpYA8N6dClUTGQGY6BOTon5nKdLv9iBs7lwxks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772860513; c=relaxed/simple; bh=h+CX0JJ0tUyfPPria3ogYiqLcW/imvT4cgeJbLA69lk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Gi7ZrDQuOf+sfmmwo6FaQcgnPTgVLU5nBqCpMExOQvqUrJGWR5z5fqwn5k8UDjhpG+YlbFy8LGB56eGsHivcoQpd5iyigvePsd9ruhaQRndhKbgYXMmO8jDGAUmkeuWnlh50GIlBfWx+gKl55Yz0FiYbZvqyffQQfn6sIP1kiTA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=lIifXCwu; arc=none smtp.client-ip=91.218.175.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="lIifXCwu" Message-ID: <22f5c641-f472-4fe9-aec5-a660efbfdd5e@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772860506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oVeP2T6JpMBn5IOWgrXjDxvTzJ0Ym2WSlHNkgDf+DoQ=; b=lIifXCwuAJ2DciDp8vw6wNT10UlQ/oC/piwkNzlvQYR/nlHCqfCgAVaf9CcKcZI9C5mtBi mdECe/aPrXuqAHnf0siVsiy8bi/h3moP0rYal02yUMPZFD/qjGDNFju9OhOK38gKokkiQl tb1CbDDm/dDLrkCLattKYQyz0lnjxR4= Date: Fri, 6 Mar 2026 21:14:56 -0800 Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH kbuild] kbuild: Allow to reduce the number of suffixes for clang thin-lto build Content-Language: en-GB To: Nathan Chancellor Cc: Josh Poimboeuf , linux-kbuild@vger.kernel.org, live-patching@vger.kernel.org, kernel-team@fb.com, Nicolas Schier , Song Liu References: <20260306034325.3605301-1-yonghong.song@linux.dev> <20260306224522.GA2746259@ax162> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yonghong Song In-Reply-To: <20260306224522.GA2746259@ax162> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT 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