[llvm] LLVM: CMake: CYGWIN needs --whole-archive for creating shared library. (PR #67887)
Carlo Bramini via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 30 09:11:50 PDT 2023
https://github.com/carlo-bramini created https://github.com/llvm/llvm-project/pull/67887
I compiled LLVM with these options:
```
-DLLVM_BUILD_LLVM_DYLIB=ON
-DLLVM_LINK_LLVM_DYLIB=ON
```
but it fails the creation of the final shared library.
To be more precise, the file `cygLLVM-18git.dll` is created, but the library is empty.
This happens because option `--whole-archive` needs to be applied.
This option already exists for other platforms, probably for the same reason, so it is only needed to add CYGWIN to the list.
>From 4d420f3d07936c9b6f3dfd0bce61b51a2b556184 Mon Sep 17 00:00:00 2001
From: Carlo Bramini <30959007+carlo-bramini at users.noreply.github.com>
Date: Sat, 30 Sep 2023 18:09:51 +0200
Subject: [PATCH] LLVM: CMake: CYGWIN needs --whole-archive for creating shared
library.
I compiled LLVM with these options:
-DLLVM_BUILD_LLVM_DYLIB=ON
-DLLVM_LINK_LLVM_DYLIB=ON
but it fails the creation of the final shared library.
To be more precise, the file cygLLVM-18git.dll is created, but the library is empty. This happens because option --whole-archive needs to be applied. This option already exists for other platforms, probably for the same reason, so it is only needed to add CYGWIN to the list.
---
llvm/tools/llvm-shlib/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt
index 4f6a2cbfbba308e..674e79cb8727224 100644
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
@@ -33,7 +33,7 @@ if(LLVM_BUILD_LLVM_DYLIB)
add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${INSTALL_WITH_TOOLCHAIN} ${SOURCES})
list(REMOVE_DUPLICATES LIB_NAMES)
- if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU)
+ if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU) OR (CYGWIN)
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "GNU")
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
More information about the llvm-commits
mailing list