Skip to content

Commit 169357d

Browse files
committed
Feat: Implement support for 'riscv64-elf-gcc' toolchain
This commit introduces logic to detect and utilize the 'riscv64-elf-gcc' compiler, commonly provided by Arch Linux and other distributions for RISC-V embedded development. The existing build system logic primarily checks for the 'riscv32-unknown-linux-gnu-gcc' and 'riscv64-unknown-elf-gcc' toolchains. The modified search priority is: 1. Risc-V 32 bit: `riscv32-unknown-linux-gnu-gcc` 2. Risc-V 64 bit: `riscv64-unknown-elf-gcc` 3. Risc-V (arch) 64 bit: `riscv64-elf-gcc` I would also suggest that this order can be upgraded by searching for the Risc-V 64 bit before searching for the 32 bit one. **Notes:** The Linux-targeting toolchain, 'riscv64-linux-gnu-gcc', is also available on arch, further testing is needed to assess its suitability versus the 'elf' variant for specific build configurations targeting full operating systems.
1 parent 45b20c8 commit 169357d

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@ configure_file(config.h.in config.h)
2323

2424
set(XT_PREFIXES ${RISCV_TOOL_PREFIX})
2525
if(NOT XT_PREFIXES)
26-
find_program(GCC_TEST riscv32-unknown-linux-gnu-gcc)
27-
if (GCC_TEST)
26+
find_program(GCC_TEST_32 riscv32-unknown-linux-gnu-gcc)
27+
find_program(GCC_TEST_64 riscv64-unknown-elf-gcc)
28+
if (GCC_TEST_32)
2829
set(XT_PREFIXES riscv32-unknown-linux-gnu-
2930
${XT_PREFIXES})
30-
else ()
31+
elseif (GCC_TEST_64)
3132
set(XT_PREFIXES riscv64-unknown-elf-
3233
${XT_PREFIXES})
34+
else ()
35+
set(XT_PREFIXES riscv64-elf-
36+
${XT_PREFIXES})
3337
endif()
3438
endif()
3539

0 commit comments

Comments
 (0)