mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 13:15:08 +00:00
51 lines
2.3 KiB
Diff
51 lines
2.3 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 4f23065a2..f180d2229 100644
|
|
--- a/clang/tools/libclang/CMakeLists.txt
|
|
+++ b/clang/tools/libclang/CMakeLists.txt
|
|
@@ -97,7 +97,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 90e290435..f72ca9646 100644
|
|
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
|
|
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
|
|
@@ -40,6 +40,7 @@ if(LLVM_BUILD_LLVM_DYLIB)
|
|
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
|
|
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")
|
|
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
|
|
+ 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
|
|
@@ -47,7 +48,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()
|