Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Timmmm committed Mar 5, 2025
1 parent f127eb0 commit 6986639
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions test/first_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,26 @@ if (CLANG_BIN)
else()
message(WARNING "Your Clang compiler does not support RISC-V (see '${CLANG_BIN} -print-targets'). Please download one from https://github.com/llvm/llvm-project/releases")
endif()
elseif (GCC_BIN_RV64)
set(CROSS_COMPILER_COMMAND_RV64 ${GCC_BIN_RV64})
if (GCC_BIN_RV32)
endif()

# Prefer riscv32-unknown-elf-gcc to riscv64-unknown-elf-gcc for RV32.
if (GCC_BIN_RV32)
if (NOT CROSS_COMPILER_COMMAND_RV32)
set(CROSS_COMPILER_COMMAND_RV32 ${GCC_BIN_RV32})
else()
# Hope it has multilib support. I'm not sure how to test that.
endif()
endif()

if (GCC_BIN_RV64)
if (NOT CROSS_COMPILER_COMMAND_RV32)
# It might support multilib.
set(CROSS_COMPILER_COMMAND_RV32 ${GCC_BIN_RV64})
endif()
else()
if (NOT CROSS_COMPILER_COMMAND_RV64)
set(CROSS_COMPILER_COMMAND_RV64 ${GCC_BIN_RV64})
endif()
endif()

if (NOT CROSS_COMPILER_COMMAND_RV32 OR NOT CROSS_COMPILER_COMMAND_RV64)
message(FATAL_ERROR "No suitable cross-compiler found. We recommend downloading Clang from https://github.com/llvm/llvm-project/releases")
endif()

Expand Down Expand Up @@ -94,7 +105,7 @@ foreach (xlen IN ITEMS 32 64)
# Indicate we are building in a standalone environment. Implies -fno-builtin
# so the compiler won't assume that memcpy etc. are available.
-ffreestanding
# Don't try to link with libc or libc.
# Don't try to link with libc or libm.
-nostdlib
# Generate a statically linked binary.
-static
Expand Down

0 comments on commit 6986639

Please sign in to comment.