Skip to content

Conversation

visitorckw
Copy link
Collaborator

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.

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.
@visitorckw visitorckw marked this pull request as draft September 2, 2025 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant