Error buidling LLVM for RISC-V

Hi all,

When building llvm for riscv64-unknown-linux-gnu target, I get this error:

Building ASM object projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-riscv64.dir/riscv/save.S.o
FAILED: projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-riscv64.dir/riscv/save.S.o
/share/pkg.7/gcc/9.3.0/install/bin/gcc -DVISIBILITY_HIDDEN -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/builtins -I/riscv/riscv-llvm/compiler-rt/lib/builtins -Iinclude -I/riscv/riscv-llvm/llvm/include -fPIC -O3 -DNDEBUG -fno-lto -std=c11 -MD -MT projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-riscv64.dir/riscv/save.S.o -MF projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-riscv64.dir/riscv/save.S.o.d -o projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-riscv64.dir/riscv/save.S.o -c /riscv/riscv-llvm/compiler-rt/lib/builtins/riscv/save.S
…riscv-llvm/compiler-rt/lib/builtins/riscv/save.S:183:3: error: #error "xlen must be 32 or 64 for save-restore implementation
183 | # error "xlen must be 32 or 64 for save-restore implementation
| ^~~~~

Here is the config I’m using:

cmake -G Ninja
-DCMAKE_BUILD_TYPE=“Release”
-DBUILD_SHARED_LIBS=True -DLLVM_USE_SPLIT_DWARF=True \
-DCMAKE_INSTALL_PREFIX="…/…/_install"
-DLLVM_ENABLE_PROJECTS=“clang;clang-tools-extra;ibcxx; libcxxabi;libunwind;lldb;compiler-rt;lld;polly”
-DLLVM_OPTIMIZED_TABLEGEN=True -DLLVM_BUILD_TESTS=False
-DDEFAULT_SYSROOT="…/…/_install/sysroot"
-DLLVM_DEFAULT_TARGET_TRIPLE=“riscv64-unknown-linux-gnu”
-DLLVM_TARGETS_TO_BUILD=“RISCV”
…/llvm

Any idea what other config options I need to use?

Thank you!