Skip to content
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

[cmake] Add hexagon-linux cmake cache files #98712

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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-linux-musl-clang++
hexagon-linux-musl-clang
hexagon-unknown-linux-musl-clang++
hexagon-unknown-linux-musl-clang
hexagon-none-elf-clang++
hexagon-none-elf-clang
hexagon-unknown-none-elf-clang++
hexagon-unknown-none-elf-clang
CACHE STRING "")

set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
15 changes: 15 additions & 0 deletions clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake
Original file line number Diff line number Diff line change
@@ -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 "")
15 changes: 15 additions & 0 deletions compiler-rt/cmake/caches/hexagon-linux-builtins.cmake
Original file line number Diff line number Diff line change
@@ -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 "")
14 changes: 14 additions & 0 deletions compiler-rt/cmake/caches/hexagon-linux-clangrt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "")
set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "")

set(COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "")

# Some build failures here, including the inline asm in
# `compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h`, so
# we can just disable these for now:
set(COMPILER_RT_BUILD_BUILTINS OFF CACHE BOOL "")
set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "")

15 changes: 15 additions & 0 deletions libcxx/cmake/caches/hexagon-linux-runtimes.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meta comment: As part of our support policy, we would like to have a CI job that builds and tests libc++ for Hexagon. I'm not very familiar with that target, but do you think you could set that up?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO landing these cache files are baby steps towards having such a CI job. I'll look into what it would take, yes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack. Just be aware that so long as there's no CI job, the platform is not officially supported so it may happen that we'll make changes that will make your life harder. We won't do it on purpose, of course, but it could happen because "no CI" == "no visibility into the impact of changes for that configuration".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely. That's been the status quo and this PR on its own can't change that.

The intent of this pull req is to allow anyone to build a toolchain for targeting hexagon (of which libc++, libc++abi, libunwind are a part). But another benefit can be that we should be able to setup CI job(s) leveraging this, indeed. We can enable regression tests for the entire toolchain including compiler, linker and target libraries.

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(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "")
set(LIBUNWIND_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(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
Loading