Skip to content

Commit bb58add

Browse files
committed
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.
1 parent 0aaf649 commit bb58add

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ ENABLE_EXT_F ?= 1
115115
$(call set-feature, EXT_F)
116116
ifeq ($(call has, EXT_F), 1)
117117
AR := ar
118+
ifeq ("$(CC_IS_CLANG)", "1")
119+
AR = llvm-ar
120+
endif
118121
ifeq ("$(CC_IS_EMCC)", "1")
119122
AR = emar
120123
endif

0 commit comments

Comments
 (0)