From ced9e415785819f1db25614b382c3f0e568861a6 Mon Sep 17 00:00:00 2001 From: Kuan-Wei Chiu Date: Wed, 3 Sep 2025 13:05:46 +0800 Subject: [PATCH 1/2] CI: Add llvm-18 bin directory to GITHUB_PATH Ensure that llvm-ar and other LLVM tools from version 18 are available in the PATH during CI builds. Without this, only the versioned binaries (e.g. llvm-ar-18) are found, which can cause build failures when unversioned tool names are expected. --- .github/workflows/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 743c1447..9c557565 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -52,6 +52,7 @@ jobs: wget https://apt.llvm.org/llvm.sh sudo chmod +x ./llvm.sh sudo ./llvm.sh 18 + echo "/usr/lib/llvm-18/bin" >> $GITHUB_PATH shell: bash - name: Install compiler id: install_cc @@ -319,6 +320,7 @@ jobs: PARALLEL: ${{ env.PARALLEL }} # Append custom commands here run: | + export PATH=/usr/lib/llvm-18/bin:$PATH make artifact make $PARALLEL make check $PARALLEL @@ -342,6 +344,7 @@ jobs: brew install make dtc expect sdl2 sdl2_mixer bc e2fsprogs p7zip llvm@18 dcfldd .ci/riscv-toolchain-install.sh echo "${{ github.workspace }}/toolchain/bin" >> $GITHUB_PATH + echo "$(brew --prefix llvm@18)/bin" >> $GITHUB_PATH - name: Install compiler id: install_cc uses: rlalik/setup-cpp-compiler@master From 7d2b787a470148b12da263410c6ceb22979d17bc Mon Sep 17 00:00:00 2001 From: Kuan-Wei Chiu Date: Wed, 3 Sep 2025 03:31:50 +0800 Subject: [PATCH 2/2] Fix build with clang by using llvm-ar When building with clang and RV32F enabled, linking fails with undefined references to SoftFloat functions. For example: $ make CC=clang-18 /usr/bin/ld: /tmp/lto-llvm-28abb9.o: in function `do_fmadds': emulate.c:(.text.do_fmadds+0x3c): undefined reference to `f32_mulAdd' /usr/bin/ld: /tmp/lto-llvm-28abb9.o: in function `do_fadds': emulate.c:(.text.do_fadds+0x31): undefined reference to `f32_add' This happens because GNU ar cannot correctly archive objects compiled with clang. Switch to llvm-ar when CC is clang, ensuring the SoftFloat library is archived correctly and the build succeeds. --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index cbadd03a..b123215a 100644 --- a/Makefile +++ b/Makefile @@ -115,6 +115,9 @@ ENABLE_EXT_F ?= 1 $(call set-feature, EXT_F) ifeq ($(call has, EXT_F), 1) AR := ar +ifeq ("$(CC_IS_CLANG)", "1") +AR = llvm-ar +endif ifeq ("$(CC_IS_EMCC)", "1") AR = emar endif