diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -1332,3 +1332,13 @@ if (LLVM_INCLUDE_UTILS AND LLVM_INCLUDE_TOOLS) add_subdirectory(utils/llvm-locstats) endif() + +#install libclang_rt.builtins-riscv64.a in the baremetal directory. +if(LLVM_TARGETS_TO_BUILD STREQUAL "RISCV") + install(DIRECTORY DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/clang/17/lib/baremetal") + install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/lib/clang/17/lib/riscv64-unknown-elf/libclang_rt.builtins.a" + DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/clang/17/lib/baremetal/" + RENAME "libclang_rt.builtins-riscv64.a" + COMPONENT cmake-exports) +endif()