From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Daniel Bertalan Date: Mon, 18 Apr 2022 22:32:29 +0200 Subject: [PATCH] [tools] 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. --- llvm/cmake/modules/HandleLLVMOptions.cmake | 2 +- llvm/tools/llvm-shlib/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index 29d0d46fdcb4..df8d63902dfd 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -181,7 +181,7 @@ if(WIN32) elseif(FUCHSIA OR UNIX) set(LLVM_ON_WIN32 0) set(LLVM_ON_UNIX 1) - if(APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX") + if(APPLE OR SERENITYOS OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX") set(LLVM_HAVE_LINK_VERSION_SCRIPT 0) else() set(LLVM_HAVE_LINK_VERSION_SCRIPT 1) diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt index b20ac318e768..d3df0de2f694 100644 --- a/llvm/tools/llvm-shlib/CMakeLists.txt +++ b/llvm/tools/llvm-shlib/CMakeLists.txt @@ -51,7 +51,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 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() -- 2.44.0