From nobody Mon Apr 6 23:10:30 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BF4793F7AB6; Tue, 17 Mar 2026 22:51:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773787899; cv=none; b=P435hkDywTR92GgTogDSHPBz5IwX8bqnMU72OA2T8Vk+DtNFQxbqh7TqvVYffzw+bPbGGMw76zcRgg66MpPouX/+kF219UGV7x7CJibjZee5PxX3IBzr+ffRvEr9gj8CVWyhPwvOYG0Pdt2UtAl3laH/aheFcLrQne8AZJCgepA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773787899; c=relaxed/simple; bh=zRKnFKqm2URNigcW6ZVhyMqoLzUjkp7pt41hjdX3o4Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oqhMOMcq6bYtPkYvHFsa1rjK/kdsqHuRQL28PRF+xHzxpdk4a1JmIZRnvvAXSHRtXgyahhmvDced9o03hKxINRnT0Uz1cBjnouX7oD0lRLftMrqcfNHKefhFfrRmUslmhXaGayxsHhISPX1gJS0TOH8z6tZOXJfNLqxUt7cwL/Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ln2wjhQf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ln2wjhQf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30FA1C4CEF7; Tue, 17 Mar 2026 22:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773787899; bh=zRKnFKqm2URNigcW6ZVhyMqoLzUjkp7pt41hjdX3o4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ln2wjhQfxqa28dJgKDCHPfGBxeRw7EOtChpVpakFKvHrihIK+pCHDpeOJJCU3Kwg0 iusyhDjRSNHcR7Ruj3FDLqNg8bW2Bz6THfXuMVdfhzXG/USsY2TYeZ+0wm4caGad3i KEy2cP9mhX6AtCDN/nDxitjMbMeqXEDP9vcYFiPzoZNEdfuk8Wu/FrJr1NKMTQpaIp 1liSaWzZ0kB1BeZgvx/+j10icge2OrRrJ6W5Qu/VcihAoZ7W1yRHoDFTNdXtcIYPv1 bp1t3fegO5isq2rinS8dwud8ggyGncjLw3D9Br1YVS9kkgqze48aMbZOmcQfAWSSRW j3dtfKuJcutPw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH v2 12/12] klp-build: Support cross-compilation Date: Tue, 17 Mar 2026 15:51:12 -0700 Message-ID: <51f026e3ee15e2dc343f890c0dc1b926ad3d1c17.1773787568.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for cross-compilation. The user must export ARCH, and either CROSS_COMPILE or LLVM as needed. Signed-off-by: Josh Poimboeuf --- scripts/livepatch/klp-build | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build index 809e198a561d..b6c057e2120f 100755 --- a/scripts/livepatch/klp-build +++ b/scripts/livepatch/klp-build @@ -404,6 +404,14 @@ validate_patches() { revert_patches } =20 +cross_compile_init() { + if [[ -v LLVM ]]; then + OBJCOPY=3Dllvm-objcopy + else + OBJCOPY=3D"${CROSS_COMPILE:-}objcopy" + fi +} + do_init() { # We're not yet smart enough to handle anything other than in-tree # builds in pwd. @@ -420,6 +428,7 @@ do_init() { validate_config set_module_name set_kernelversion + cross_compile_init } =20 # Refresh the patch hunk headers, specifically the line numbers and counts. @@ -783,7 +792,7 @@ build_patch_module() { cp -f "$kmod_file" "$kmod_file.orig" =20 # Work around issue where slight .config change makes corrupt BTF - objcopy --remove-section=3D.BTF "$kmod_file" + "$OBJCOPY" --remove-section=3D.BTF "$kmod_file" =20 # Fix (and work around) linker wreckage for klp syms / relocs "$SRC/tools/objtool/objtool" klp post-link "$kmod_file" || die "objtool k= lp post-link failed" --=20 2.53.0