[libcxx-commits] [clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 12 21:39:06 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Brian Cain (androm3da)

<details>
<summary>Changes</summary>

These can be used to create a fully-bootstrapped toolchain to target hexagon {baremetal,linux} with scripts like the ones in https://github.com/quic/toolchain_for_hexagon

---
Full diff: https://github.com/llvm/llvm-project/pull/98712.diff


4 Files Affected:

- (added) clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake (+11) 
- (added) clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake (+15) 
- (added) compiler-rt/cmake/caches/hexagon-linux-builtins.cmake (+15) 
- (added) libcxx/cmake/caches/hexagon-linux-runtimes.cmake (+25) 


``````````diff
diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake
new file mode 100644
index 0000000000000..2df7d8183baa6
--- /dev/null
+++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake
@@ -0,0 +1,11 @@
+# This file is for the llvm+clang options that are specific to building
+# a cross-toolchain targeting hexagon linux.
+set(DEFAULT_SYSROOT "../target/hexagon-unknown-linux-musl/" CACHE STRING "")
+set(CLANG_LINKS_TO_CREATE
+            hexagon-unknown-linux-musl-clang++
+            hexagon-unknown-linux-musl-clang
+            hexagon-unknown-none-elf-clang++
+            hexagon-unknown-none-elf-clang
+            CACHE STRING "")
+
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
diff --git a/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake
new file mode 100644
index 0000000000000..9f3eb4678fd17
--- /dev/null
+++ b/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake
@@ -0,0 +1,15 @@
+
+set(LLVM_TARGETS_TO_BUILD "Hexagon" CACHE STRING "")
+set(LLVM_DEFAULT_TARGET_TRIPLE "hexagon-unknown-linux-musl" CACHE STRING "")
+set(CLANG_DEFAULT_CXX_STDLIB "libc++" CACHE STRING "")
+set(CLANG_DEFAULT_OBJCOPY "llvm-objcopy" CACHE STRING "")
+set(CLANG_DEFAULT_RTLIB "compiler-rt" CACHE STRING "")
+set(CLANG_DEFAULT_UNWINDLIB "libunwind" CACHE STRING "")
+set(CLANG_DEFAULT_LINKER "lld" CACHE STRING "")
+set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "")
+
+set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
+set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "")
+# Enabling toolchain-only causes problems when doing some of the
+# subsequent builds, will need to investigate:
+set(LLVM_INSTALL_TOOLCHAIN_ONLY OFF CACHE BOOL "")
diff --git a/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake
new file mode 100644
index 0000000000000..d9c9ff2a4655e
--- /dev/null
+++ b/compiler-rt/cmake/caches/hexagon-linux-builtins.cmake
@@ -0,0 +1,15 @@
+set(CMAKE_ASM_FLAGS "-G0 -mlong-calls -fno-pic" CACHE STRING "")
+
+set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "")
+set(LLVM_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "")
+set(COMPILER_RT_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "")
+set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
+set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "")
+set(COMPILER_RT_BUILTINS_ENABLE_PIC OFF CACHE BOOL "")
+set(COMPILER_RT_SUPPORTED_ARCH hexagon CACHE STRING "")
diff --git a/libcxx/cmake/caches/hexagon-linux-runtimes.cmake b/libcxx/cmake/caches/hexagon-linux-runtimes.cmake
new file mode 100644
index 0000000000000..fc669ecab737e
--- /dev/null
+++ b/libcxx/cmake/caches/hexagon-linux-runtimes.cmake
@@ -0,0 +1,25 @@
+
+set(CMAKE_EXE_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "")
+set(CMAKE_SHARED_LINKER_FLAGS "-lclang_rt.builtins-hexagon -nostdlib" CACHE STRING "")
+set(CMAKE_CXX_COMPILER_TARGET hexagon-unknown-linux-musl CACHE STRING "")
+
+set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "")
+set(LLVM_ENABLE_RUNTIMES "libcxx;libcxxabi;libunwind;compiler-rt" CACHE STRING "")
+set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "")
+set(LIBCXX_HAS_MUSL_LIBC ON CACHE BOOL "")
+set(LIBCXX_INCLUDE_TESTS ON CACHE BOOL "")
+set(LIBCXXABI_INCLUDE_TESTS ON CACHE BOOL "")
+set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
+set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
+set(LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "")
+set(COMPILER_RT_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "")
+set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_SANITIZERS ON CACHE BOOL "")
+set(COMPILER_RT_SUPPORTED_ARCH hexagon CACHE STRING "")
+set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "")
+set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
+
+# This was added as a fix/workaround for changes introduced by llvm-project
+# commit https://github.com/llvm/llvm-project/commit/ab41ea4be364dcac32d0c4ec990735c8adb279c8
+set(CXX_SUPPORTS_NOSTDLIBXX_FLAG OFF CACHE BOOL "")

``````````

</details>


https://github.com/llvm/llvm-project/pull/98712


More information about the libcxx-commits mailing list