summaryrefslogtreecommitdiff
path: root/Toolchain/CMake/LLVMConfig.cmake
diff options
context:
space:
mode:
authorDaniel Bertalan <dani@danielbertalan.dev>2021-08-13 12:11:12 +0200
committerLinus Groh <mail@linusgroh.de>2021-10-17 17:09:58 +0100
commit06fc64be13d933a47232243732dc8ca8313374ed (patch)
tree8dd3a60deffe21fd52a17f164abadddb6904521a /Toolchain/CMake/LLVMConfig.cmake
parent28c088cd9104b7b4fbcfe860a718291da3f9a5f3 (diff)
downloadserenity-06fc64be13d933a47232243732dc8ca8313374ed.zip
Toolchain+Meta: Update LLVM version to 13.0.0
This commit updates the Clang toolchain's version to 13.0.0, which comes with better C++20 support and improved handling of new features by clang-format. Due to the newly enabled `-Bsymbolic-functions` flag, our Clang binaries will only be 2-4% slower than if we dynamically linked them, but we save hundreds of megabytes of disk space. The `BuildClang.sh` script has been reworked to build the entire toolchain in just three steps: one for the compiler, one for GNU binutils, and one for the runtime libraries. This reduces the complexity of the build script, and will allow us to modify the CI configuration to only rebuild the libraries when our libc headers change. Most of the compile flags have been moved out to a separate CMake cache file, similarly to how the Android and Fuchsia toolchains are implemented within the LLVM repo. This provides a nicer interface than the heaps of command-line arguments. We no longer build separate toolchains for each architecture, as the same Clang binary can compile code for multiple targets. The horrible mess that `SERENITY_CLANG_ARCH` was, has been removed in this commit. Clang happily accepts an `i686-pc-serenity` target triple, which matches what our GCC toolchain accepts.
Diffstat (limited to 'Toolchain/CMake/LLVMConfig.cmake')
-rw-r--r--Toolchain/CMake/LLVMConfig.cmake67
1 files changed, 67 insertions, 0 deletions
diff --git a/Toolchain/CMake/LLVMConfig.cmake b/Toolchain/CMake/LLVMConfig.cmake
new file mode 100644
index 0000000000..ee9cd36e59
--- /dev/null
+++ b/Toolchain/CMake/LLVMConfig.cmake
@@ -0,0 +1,67 @@
+# This file specifies the options used for building the Clang compiler, LLD linker and the compiler builtins library
+
+set(CMAKE_BUILD_TYPE Release CACHE STRING "")
+
+set(LLVM_TARGETS_TO_BUILD "X86;AArch64" CACHE STRING "")
+
+set(LLVM_ENABLE_PROJECTS "llvm;clang;lld" CACHE STRING "")
+set(LLVM_ENABLE_RUNTIMES "compiler-rt" CACHE STRING "")
+
+set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
+set(LLVM_ENABLE_BINDINGS OFF CACHE BOOL "")
+set(LLVM_INCLUDE_BENCHMARKS OFF CACHE BOOL "")
+set(LLVM_BUILD_UTILS OFF CACHE BOOL "")
+set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
+set(LLVM_BUILD_LLVM_DYLIB ON CACHE BOOL "")
+set(LLVM_LINK_LLVM_DYLIB ON CACHE BOOL "")
+set(LLVM_INSTALL_UTILS OFF CACHE BOOL "")
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+set(LLVM_INSTALL_BINUTILS_SYMLINKS OFF CACHE BOOL "")
+
+set(CLANG_ENABLE_CLANGD OFF CACHE BOOL "")
+
+set(compiler_flags "-nostdlib -nostdlib++")
+foreach(target i686-pc-serenity;x86_64-pc-serenity;aarch64-pc-serenity)
+ list(APPEND targets "${target}")
+
+ set(RUNTIMES_${target}_CMAKE_BUILD_TYPE Release CACHE STRING "")
+ set(RUNTIMES_${target}_CMAKE_SYSROOT ${SERENITY_${target}_SYSROOT} CACHE PATH "")
+ set(RUNTIMES_${target}_CMAKE_C_FLAGS ${compiler_flags} CACHE STRING "")
+ set(RUNTIMES_${target}_CMAKE_CXX_FLAGS ${compiler_flags} CACHE STRING "")
+ set(RUNTIMES_${target}_COMPILER_RT_BUILD_CRT ON CACHE BOOL "")
+ set(RUNTIMES_${target}_COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_COMPILER_RT_BUILD_ORC OFF CACHE BOOL "")
+
+ set(BUILTINS_${target}_CMAKE_BUILD_TYPE Release CACHE STRING "")
+ set(BUILTINS_${target}_CMAKE_SYSROOT ${SERENITY_${target}_SYSROOT} CACHE PATH "")
+ set(BUILTINS_${target}_COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN OFF CACHE BOOL "")
+endforeach()
+
+set(LLVM_TOOLCHAIN_TOOLS
+ llvm-addr2line
+ llvm-ar
+ llvm-cov
+ llvm-cxxfilt
+ llvm-dwarfdump
+ llvm-ifs
+ llvm-lib
+ llvm-nm
+ llvm-objcopy
+ llvm-objdump
+ llvm-profdata
+ llvm-rc
+ llvm-ranlib
+ llvm-readelf
+ llvm-readobj
+ llvm-size
+ llvm-strings
+ llvm-strip
+ llvm-symbolizer
+ CACHE STRING "")
+
+set(LLVM_RUNTIME_TARGETS ${targets} CACHE STRING "")
+set(LLVM_BUILTIN_TARGETS ${targets} CACHE STRING "")