-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[CMake] Include riscv32-unknown-elf runtimes in Fuchsia toolchain #76849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-clang Author: Petr Hosek (petrhosek) ChangesThis contains compiler-rt builtins and llvm-libc for baremetal use. Differential Revision: https://reviews.llvm.org/D155337 Full diff: https://github.com/llvm/llvm-project/pull/76849.diff 2 Files Affected:
diff --git a/clang/cmake/caches/Fuchsia-stage2.cmake b/clang/cmake/caches/Fuchsia-stage2.cmake
index c4673c8a54c5ef..eee37c5e7901fa 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -6,7 +6,7 @@ set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64;RISCV CACHE STRING "")
set(PACKAGE_VENDOR Fuchsia CACHE STRING "")
-set(_FUCHSIA_ENABLE_PROJECTS "bolt;clang;clang-tools-extra;lld;llvm;polly")
+set(_FUCHSIA_ENABLE_PROJECTS "bolt;clang;clang-tools-extra;libc;lld;llvm;polly")
set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
set(LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "")
@@ -22,8 +22,11 @@ set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "")
set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "")
set(LLVM_ENABLE_ZLIB ON CACHE BOOL "")
+set(LLVM_FORCE_BUILD_RUNTIME ON CACHE BOOL "")
set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "")
set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "")
+set(LLVM_LIBC_FULL_BUILD ON CACHE BOOL "")
+set(LIBC_HDRGEN_ONLY ON CACHE BOOL "")
set(LLVM_STATIC_LINK_CXX_STDLIB ON CACHE BOOL "")
set(LLVM_USE_RELATIVE_PATHS_IN_FILES ON CACHE BOOL "")
set(LLDB_ENABLE_CURSES OFF CACHE BOOL "")
@@ -297,6 +300,39 @@ if(FUCHSIA_SDK)
set(LLVM_RUNTIME_MULTILIB_hwasan+noexcept_TARGETS "aarch64-unknown-fuchsia;riscv64-unknown-fuchsia" CACHE STRING "")
endif()
+foreach(target riscv32-unknown-elf)
+ list(APPEND BUILTIN_TARGETS "${target}")
+ set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
+ set(BUILTINS_${target}_CMAKE_SYSTEM_PROCESSOR RISCV CACHE STRING "")
+ set(BUILTINS_${target}_CMAKE_SYSROOT "" CACHE STRING "")
+ set(BUILTINS_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
+ foreach(lang C;CXX;ASM)
+ set(BUILTINS_${target}_CMAKE_${lang}_FLAGS "--target=${target} -march=rv32imafc -mabi=ilp32f" CACHE STRING "")
+ endforeach()
+ foreach(type SHARED;MODULE;EXE)
+ set(BUILTINS_${target}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
+ endforeach()
+ set(BUILTINS_${target}_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL "")
+
+ list(APPEND RUNTIME_TARGETS "${target}")
+ set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
+ set(RUNTIMES_${target}_CMAKE_SYSTEM_PROCESSOR RISCV CACHE STRING "")
+ set(RUNTIMES_${target}_CMAKE_SYSROOT "" CACHE STRING "")
+ set(RUNTIMES_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
+ set(RUNTIMES_${target}_CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY CACHE STRING "")
+ foreach(lang C;CXX;ASM)
+ set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "--target=${target} -march=rv32imafc -mabi=ilp32f" CACHE STRING "")
+ endforeach()
+ foreach(type SHARED;MODULE;EXE)
+ set(RUNTIMES_${target}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
+ endforeach()
+ set(RUNTIMES_${target}_LLVM_LIBC_FULL_BUILD ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBC_ENABLE_USE_BY_CLANG ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "libc" CACHE STRING "")
+endforeach()
+
set(LLVM_BUILTIN_TARGETS "${BUILTIN_TARGETS}" CACHE STRING "")
set(LLVM_RUNTIME_TARGETS "${RUNTIME_TARGETS}" CACHE STRING "")
diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 77254b7eb5e622..cd2494cf0d3a45 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -414,7 +414,7 @@ if(runtimes)
endif()
endforeach()
endif()
- if("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND
+ if("libc" IN_LIST LLVM_ENABLE_RUNTIMES AND
(LLVM_LIBC_FULL_BUILD OR LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES))
if(TARGET libc-hdrgen)
set(libc_tools libc-hdrgen)
|
Prabhuk
approved these changes
Jan 3, 2024
This contains compiler-rt builtins and llvm-libc for baremetal use. Differential Revision: https://reviews.llvm.org/D155337
01dd937
to
0cb22be
Compare
petrhosek
added a commit
to petrhosek/llvm-project
that referenced
this pull request
Jan 16, 2024
…vm#76849) This contains compiler-rt builtins and llvm-libc for baremetal use. Differential Revision: https://reviews.llvm.org/D155337
justinfargnoli
pushed a commit
to justinfargnoli/llvm-project
that referenced
this pull request
Jan 28, 2024
…vm#76849) This contains compiler-rt builtins and llvm-libc for baremetal use. Differential Revision: https://reviews.llvm.org/D155337
justinfargnoli
pushed a commit
to justinfargnoli/llvm-project
that referenced
this pull request
Jan 28, 2024
…hain (llvm#76849)" This reverts commit 78550be since it broke the two stage build.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This contains compiler-rt builtins and llvm-libc for baremetal use.
Differential Revision: https://reviews.llvm.org/D155337