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

Brian Cain via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 17 06:12:38 PDT 2024


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

>From c01c1ee772c86ac637578fca866588b8191b15c4 Mon Sep 17 00:00:00 2001
From: Brian Cain <bcain at quicinc.com>
Date: Fri, 12 Jul 2024 21:34:56 -0700
Subject: [PATCH] [cmake] Add hexagon-linux cmake cache files

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

Signed-off-by: Brian Cain <bcain at quicinc.com>
---
 ...xagon-unknown-linux-musl-clang-cross.cmake | 11 +++++++++++
 .../hexagon-unknown-linux-musl-clang.cmake    | 15 +++++++++++++++
 .../cmake/caches/hexagon-linux-builtins.cmake | 15 +++++++++++++++
 .../cmake/caches/hexagon-linux-runtimes.cmake | 19 +++++++++++++++++++
 4 files changed, 60 insertions(+)
 create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake
 create mode 100644 clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake
 create mode 100644 compiler-rt/cmake/caches/hexagon-linux-builtins.cmake
 create mode 100644 libcxx/cmake/caches/hexagon-linux-runtimes.cmake

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..99b07b0c05be2
--- /dev/null
+++ b/libcxx/cmake/caches/hexagon-linux-runtimes.cmake
@@ -0,0 +1,19 @@
+
+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 OFF CACHE BOOL "")
+set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
+set(LIBCXXABI_USE_LLVM_UNWINDER ON 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(LIBCXX_HAS_ATOMIC_LIB OFF CACHE BOOL "")
+set(LIBCXXABI_HAS_ATOMIC_LIB OFF CACHE BOOL "")
+set(LIBUNWIND_HAS_ATOMIC_LIB OFF CACHE BOOL "")
+set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
+set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")



More information about the libcxx-commits mailing list