Skip to content

Commit 3066e9f

Browse files
committed
[LLVM][Cygwin] Fix symbol visibility definition
1 parent 962ca19 commit 3066e9f

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ function(llvm_add_library name)
666666
# When building shared objects for each target there are some internal APIs
667667
# that are used across shared objects which we can't hide.
668668
if (LLVM_BUILD_LLVM_DYLIB_VIS AND NOT BUILD_SHARED_LIBS AND NOT APPLE AND
669-
(NOT (WIN32 OR CYGWIN) OR (MINGW AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")) AND
669+
(NOT (WIN32 OR CYGWIN) OR ((MINGW OR CYGWIN) AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")) AND
670670
NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX") AND
671671
NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET)
672672

llvm/include/llvm/Support/Compiler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
#endif
130130

131131
#if (!(defined(_WIN32) || defined(__CYGWIN__)) || \
132-
(defined(__MINGW32__) && defined(__clang__)))
132+
((defined(__MINGW32__) || defined (__CYGWIN__)) && defined(__clang__)))
133133
#define LLVM_LIBRARY_VISIBILITY LLVM_ATTRIBUTE_VISIBILITY_HIDDEN
134134
// Clang compilers older then 15 do not support gnu style attributes on
135135
// namespaces.
@@ -198,7 +198,7 @@
198198
#endif
199199
#define LLVM_ABI_EXPORT __declspec(dllexport)
200200
#elif defined(__ELF__) || defined(__MINGW32__) || defined(_AIX) || \
201-
defined(__MVS__)
201+
defined(__MVS__) || defined(__CYGWIN__)
202202
#define LLVM_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
203203
#define LLVM_TEMPLATE_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
204204
#define LLVM_EXPORT_TEMPLATE

llvm/lib/Target/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ add_llvm_component_library(LLVMTarget
2222
# When building shared objects for each target there are some internal APIs
2323
# that are used across shared objects which we can't hide.
2424
if (NOT BUILD_SHARED_LIBS AND NOT APPLE AND
25-
(NOT (WIN32 OR CYGWIN) OR (MINGW AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")) AND
25+
(NOT (WIN32 OR CYGWIN) OR ((MINGW OR CYGWIN) AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")) AND
2626
NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX") AND
2727
NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET)
2828
# Set default visibility to hidden, so we don't export all the Target classes

llvm/tools/llvm-shlib/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ if(LLVM_BUILD_LLVM_DYLIB)
6666
else()
6767
# GNU ld doesn't resolve symbols in the version script.
6868
set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive)
69-
if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT MINGW)
69+
if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT (MINGW OR CYGWIN))
7070
# Solaris ld does not accept global: *; so there is no way to version *all* global symbols
7171
set(LIB_NAMES -Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map ${LIB_NAMES})
7272
endif()
73-
if (NOT MINGW AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS)
73+
if (NOT (MINGW OR CYGWIN) AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS)
7474
# Optimize function calls for default visibility definitions to avoid PLT and
7575
# reduce dynamic relocations.
7676
# Note: for -fno-pic default, the address of a function may be different from

0 commit comments

Comments
 (0)