summaryrefslogtreecommitdiff
path: root/Toolchain/Patches
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2022-01-02 21:51:27 -0700
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-01-03 11:08:45 +0000
commitc5898806d2f1aeb059c846d502e78403fa365831 (patch)
treed4a57134c46e80d47e76d208e764cc5751bb3b05 /Toolchain/Patches
parentaf31253a160bfdde58587ee92afe1476ecc27e16 (diff)
downloadserenity-c5898806d2f1aeb059c846d502e78403fa365831.zip
Toolchain: Use Platform/SerenityOS.cmake in LLVM toolchain build
By setting CMAKE_MODULE_PATH in the LLVM initial cache scripts, we can make the "SerenityOS" CMAKE_SYSTEM_NAME usable in the builds of compiler-rt, libunwind, libcxxabi and libcxx. This simplifies some toolchain patches and brings the cross-compiler patches closer to the Port's patches, and closer to something upstreamable.
Diffstat (limited to 'Toolchain/Patches')
-rw-r--r--Toolchain/Patches/llvm.patch33
1 files changed, 19 insertions, 14 deletions
diff --git a/Toolchain/Patches/llvm.patch b/Toolchain/Patches/llvm.patch
index 2f781da8cc..e484cbc2fc 100644
--- a/Toolchain/Patches/llvm.patch
+++ b/Toolchain/Patches/llvm.patch
@@ -592,6 +592,19 @@ index ba9f96384..4aecfeee2 100644
return;
case llvm::Triple::Win32:
+diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
+index 39b9120f0..1a49ac3e5 100644
+--- a/compiler-rt/cmake/config-ix.cmake
++++ b/compiler-rt/cmake/config-ix.cmake
+@@ -684,7 +684,7 @@ endif()
+
+ # TODO: Add builtins support.
+
+-if (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux" AND NOT LLVM_USE_SANITIZER)
++if (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux|SerenityOS" AND NOT LLVM_USE_SANITIZER)
+ set(COMPILER_RT_HAS_CRT TRUE)
+ else()
+ set(COMPILER_RT_HAS_CRT FALSE)
diff --git a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
index ad2820b32..deaa2c380 100644
--- a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
@@ -736,26 +749,18 @@ index d5ab8fb3b..5039c1987 100644
// Newlib has a 257-entry table in ctype_.c, where (char)0 starts at [1].
return _ctype_ + 1;
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
-index 0c3419390..75f8b552b 100644
+index 0c3419390..7673b9183 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
-@@ -228,11 +228,11 @@ endif()
+@@ -228,7 +228,7 @@ endif()
# Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
# build might work on ELF but fail on MachO/COFF.
-if(NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin|FreeBSD|OpenBSD|DragonFly|AIX|SunOS|OS390" OR
-- WIN32 OR CYGWIN) AND
-- NOT LLVM_USE_SANITIZER)
-- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
--endif()
-+#if(NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin|FreeBSD|OpenBSD|DragonFly|AIX|SunOS|OS390" OR
-+# WIN32 OR CYGWIN) AND
-+# NOT LLVM_USE_SANITIZER)
-+# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
-+#endif()
-
- # Pass -Wl,-z,nodelete. This makes sure our shared libraries are not unloaded
- # by dlclose(). We need that since the CLI API relies on cross-references
++if(NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin|FreeBSD|OpenBSD|DragonFly|AIX|SunOS|OS390|SerenityOS" OR
+ WIN32 OR CYGWIN) AND
+ NOT LLVM_USE_SANITIZER)
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
index 76f351405..b81556c55 100644
--- a/llvm/include/llvm/ADT/Triple.h