From b3008567ea0fa2942115d4c4013a16f3ff0e4952 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 16 Apr 2025 16:12:58 +0200 Subject: all: use LLVM=1 for building Linux with clang This is the standard way now. Since our configuration permits multiple parameter value combinations, explicitly check for the compiler and linker that were to be passed via CC and LD, and replace that with LLVM=1 if they were clang and ld.lld correspondingly. Update syz-kconf to rely on pkg/build's exported functionality for generating Linux kernel build arguments. --- sys/targets/targets.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sys') diff --git a/sys/targets/targets.go b/sys/targets/targets.go index 2cf001473..50f5c5121 100644 --- a/sys/targets/targets.go +++ b/sys/targets/targets.go @@ -881,6 +881,11 @@ func (target *Target) Timeouts(slowdown int) Timeouts { return timeouts } +const ( + DefaultLLVMCompiler = "clang" + DefaultLLVMLinker = "ld.lld" +) + func (target *Target) setCompiler(clang bool) { // setCompiler may be called effectively twice for target.other, // so first we remove flags the previous call may have added. @@ -895,9 +900,9 @@ func (target *Target) setCompiler(clang bool) { } target.CFlags = target.CFlags[:pos] if clang { - target.CCompiler = "clang" - target.KernelCompiler = "clang" - target.KernelLinker = "ld.lld" + target.CCompiler = DefaultLLVMCompiler + target.KernelCompiler = DefaultLLVMCompiler + target.KernelLinker = DefaultLLVMLinker if target.Triple != "" { target.CFlags = append(target.CFlags, "--target="+target.Triple) } -- cgit mrf-deployment