From 5d087d63bc8eb2e3208e4775937cba131554c729 Mon Sep 17 00:00:00 2001 From: vasilito Date: Fri, 31 Jul 2026 11:03:12 +0300 Subject: [PATCH] llvm21: add AMDGPU LLVM target for Mesa radeonsi/radv (amd64-only) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mesa's radeonsi/radv AMD-GPU drivers require the LLVM 'amdgpu' codegen backend (dependency('llvm', modules: [... amdgpu ...])). llvm21 built X86 only, so the host llvm-config the mesa build reads reported amdgpu(missing). Add AMDGPU to LLVM_TARGETS_TO_BUILD (X86;AMDGPU per the amd64-only policy — AMDGPU is a GPU backend, not a second CPU platform). This is the redox-target LLVM whose libs mesa links AND the source of the prefix clang-install host LLVM. NB: the ~/.redoxer toolchain host llvm-config (a provisioned prebuilt) still needs the rebuilt AMDGPU host-LLVM propagated into it (follow-up). --- recipes/dev/llvm21/recipe.toml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/recipes/dev/llvm21/recipe.toml b/recipes/dev/llvm21/recipe.toml index c210b8f07b..7a5492fb3b 100644 --- a/recipes/dev/llvm21/recipe.toml +++ b/recipes/dev/llvm21/recipe.toml @@ -68,14 +68,20 @@ set(ENV{CFLAGS} "") set(ENV{CXXFLAGS} "") NATIVE_EOF +# amd64-only (see local/AGENTS.md): the CPU target is X86 (= amd64/x86_64). +# AMDGPU is the GPU codegen backend Mesa's radeonsi/radv (AMD GPU) drivers +# require via `dependency('llvm', modules: [... amdgpu ...])` — without it the +# host llvm-config the mesa build reads reports amdgpu(missing) and mesa fails +# to configure. AMDGPU is a GPU backend, not a second CPU platform, so it does +# not violate amd64-only. case "${ARCH}" in - x86 | x86_64) LLVM_TARGETS_TO_BUILD="X86";; - aarch64) LLVM_TARGETS_TO_BUILD="AArch64";; - riscv64gc) LLVM_TARGETS_TO_BUILD="RISCV";; + x86 | x86_64) LLVM_TARGETS_TO_BUILD="X86;AMDGPU";; + aarch64) LLVM_TARGETS_TO_BUILD="AArch64;AMDGPU";; + riscv64gc) LLVM_TARGETS_TO_BUILD="RISCV;AMDGPU";; esac if [ "${COOKBOOK_HOST_SYSROOT}" = "/usr" ]; then - LLVM_TARGETS_TO_BUILD="X86;AArch64;RISCV" + LLVM_TARGETS_TO_BUILD="X86;AMDGPU" fi # This just build the LLVM library and tools just enough for Rust, to build the rest of LLVM see