mirror of
https://github.com/RGBCube/serenity
synced 2025-10-16 23:32:26 +00:00
51 lines
2.5 KiB
Diff
51 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Bertalan <dani@danielbertalan.dev>
|
|
Date: Mon, 18 Apr 2022 22:32:29 +0200
|
|
Subject: [PATCH] [cmake] Support building shared libLLVM and libClang for
|
|
SerenityOS
|
|
|
|
This patch tells CMake that the --whole-archive linker option should be
|
|
used for specifying the archives whose members will constitute these
|
|
shared libraries.
|
|
|
|
Symbol versioning is disabled, as the SerenityOS loader doesn't support
|
|
it, and the ELF sections that store version data would just waste space.
|
|
---
|
|
clang/tools/libclang/CMakeLists.txt | 2 +-
|
|
llvm/tools/llvm-shlib/CMakeLists.txt | 3 ++-
|
|
2 files changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
|
|
index c6b3b44a76334b86167971c48891db898d01f8d0..d43e0b4c1f7796c17c524626fba59e0dfaebf4b2 100644
|
|
--- a/clang/tools/libclang/CMakeLists.txt
|
|
+++ b/clang/tools/libclang/CMakeLists.txt
|
|
@@ -96,7 +96,7 @@ if(MSVC)
|
|
set(LLVM_EXPORTED_SYMBOL_FILE)
|
|
endif()
|
|
|
|
-if (UNIX AND NOT APPLE)
|
|
+if (UNIX AND NOT APPLE AND (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "SerenityOS"))
|
|
set(LLVM_EXPORTED_SYMBOL_FILE)
|
|
set(USE_VERSION_SCRIPT ${LLVM_HAVE_LINK_VERSION_SCRIPT})
|
|
endif()
|
|
diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt
|
|
index 8e2b78f1b85c0f2664f84e24d7588bb60e37fe77..909018753e2e09cb3a46bae35e9aaa45cc7703bc 100644
|
|
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
|
|
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
|
|
@@ -39,6 +39,7 @@ if(LLVM_BUILD_LLVM_DYLIB)
|
|
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
|
|
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
|
|
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")
|
|
+ OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "SerenityOS")
|
|
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")) # FIXME: It should be "GNU ld for elf"
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/simple_version_script.map.in
|
|
@@ -46,7 +47,7 @@ if(LLVM_BUILD_LLVM_DYLIB)
|
|
|
|
# GNU ld doesn't resolve symbols in the version script.
|
|
set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive)
|
|
- if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT MINGW)
|
|
+ if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT MINGW AND (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "SerenityOS"))
|
|
# Solaris ld does not accept global: *; so there is no way to version *all* global symbols
|
|
set(LIB_NAMES -Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map ${LIB_NAMES})
|
|
endif()
|