This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add riscv{32,64} to ALL_CRT_SUPPORTED_ARCH list
ClosedPublic

Authored by edward-jones on Oct 3 2019, 7:13 AM.

Details

Summary

This allows crtbegin and crtend to be built, allowing RISC-V to no longer rely on implementations from libgcc.

Diff Detail

Event Timeline

edward-jones created this revision.Oct 3 2019, 7:13 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 3 2019, 7:13 AM
Herald added subscribers: llvm-commits, Restricted Project, simoncook and 10 others. · View Herald Transcript

@edward-jones: what LLVM cmake options are you using to test this?

@edward-jones: what LLVM cmake options are you using to test this?

Here's the flags I'm using for my build.

cmake llvm-project/compiler-rt
  -G "Ninja"
  -DCMAKE_INSTALL_PREFIX=<llvm_install>/riscv32-unknown-elf
  -DCOMPILER_RT_BUILD_BUILTINS=ON
  -DCOMPILER_RT_BUILD_SANITIZERS=OFF
  -DCOMPILER_RT_BUILD_XRAY=OFF
  -DCOMPILER_RT_BUILD_LIBFUZZER=OFF
  -DCOMPILER_RT_BUILD_PROFILE=OFF
  -DCMAKE_C_COMPILER=<llvm_install>/bin/clang
  -DCMAKE_AR=<llvm_install>/bin/llvm-ar
  -DCMAKE_NM=<llvm_install>/bin/llvm-nm
  -DCMAKE_RANLIB=<llvm_install>/bin/llvm-ranlib
  -DCMAKE_C_COMPILER_TARGET="riscv32-unknown-elf"
  -DCMAKE_ASM_COMPILER_TARGET="riscv32-unknown-elf"
  -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
  -DLLVM_CONFIG_PATH=<llvm_install>/bin/llvm-config
  -DCMAKE_C_FLAGS="-march=rv32gc -mabi=ilp32d"
  -DCMAKE_ASM_FLAGS="-march=rv32gc -mabi=ilp32d"
  -DCMAKE_EXE_LINKER_FLAGS="-nostartfiles -nostdlib"
  -DCOMPILER_RT_BAREMETAL_BUILD=ON
  -DCOMPILER_RT_OS_DIR=""
lenary accepted this revision.Oct 17 2019, 5:58 AM

I have finally got the runtimes building. There's basically no documentation for the compiler-rt build system, which is very infuriating. Instead I needed to do a close reading of the cmake sources. I believe I have the correct configuration now, which I need to save somewhere (potentially so it becomes available for others).

Yes, this patch is required to ensure that you can build the compiler-rt builtins and the compiler-rt crtbegin and crtend. I am happy for it to land.

This revision is now accepted and ready to land.Oct 17 2019, 5:58 AM
This revision was automatically updated to reflect the committed changes.