I have been working on patches for compiling Swift 5.6 for RISCV64 with Buildroot. First I compiled the patched compiler (swift, llvm-project and swift-core-tools-support) and then use Buildroot with patched compiler to cross compiler the Swift Stdlib. I have gotten to the point where I can successfully compile libdispatch, the Swift StdLib and runtime's .c, .cpp and .swift files for RISCV64, but the linking stage for the StdLib fails.
ld.lld: error: stdlib/public/core/LINUX/riscv64/Swift.o: cannot link object files with different floating-point ABI
ld.lld: error: Swift.o![|16x16](https://bugs.swift.org/images/icons/emoticons/sad.png).text+0x0): relocation R_RISCV_ALIGN requires unimplemented linker relaxation; recompile with -mno-relax
Amazing work!, @ColemanCDA. This has so much potential!
As a matter of fact, I just recently started to get into microcontrollers. In particular I'm supposed to write the firmware for an ESP32-C3 (RISCV32) based device and would love to use Swift rather than C and C++.
How similar are RISCV32 and RISCV64? What would it take to enhance your patch to also support RISCV32?
The issue is, RISCV32 is tipically not Linux capable and lacking MMU. The ISA itself is not an issue, it's the devices you can buy with that ISA not being designed for Linux. If you find a RISCV32 devices that can run Linux, let me know and I'll try to build Swift for it.