[llvm] 606348c - [MinGW] Don't currently set visibility=hidden when building for MinGW

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 13:17:34 PDT 2022


Author: Martin Storsjö
Date: 2022-07-21T23:16:33+03:00
New Revision: 606348cc72389de481c014afb0f15af7360fc950

URL: https://github.com/llvm/llvm-project/commit/606348cc72389de481c014afb0f15af7360fc950
DIFF: https://github.com/llvm/llvm-project/commit/606348cc72389de481c014afb0f15af7360fc950.diff

LOG: [MinGW] Don't currently set visibility=hidden when building for MinGW

If we build the Target libraries with -fvisibility=hidden, then
LLVM_EXTERNAL_VISIBILITY must also be able to override it back
to default visibility.

Currently, the LLVM_EXTERNAL_VISIBILITY define is a no-op for
mingw targets, thus set CMAKE_CXX_VISIBILITY_PRESET correspondingly.

This unbreaks the mingw dylib build, if the compiler actually
takes hidden visiblity into account (e.g. after D130121).

(Later, once hidden visiblity can be used for MinGW targets, we
can make LLVM_EXTERNAL_VISIBILITY and LLVM_LIBRARY_VISIBILITY expand
to actual attributes, and reverse this commit.)

Differential Revision: https://reviews.llvm.org/D130200

Added: 
    

Modified: 
    llvm/lib/Target/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/CMakeLists.txt b/llvm/lib/Target/CMakeLists.txt
index 35a8e9ae0f708..c0c2bc36a6e47 100644
--- a/llvm/lib/Target/CMakeLists.txt
+++ b/llvm/lib/Target/CMakeLists.txt
@@ -22,6 +22,7 @@ add_llvm_component_library(LLVMTarget
 # When building shared objects for each target there are some internal APIs
 # that are used across shared objects which we can't hide.
 if (NOT BUILD_SHARED_LIBS AND NOT APPLE AND
+    NOT MINGW AND
     NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX") AND
     NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET)
   # Set default visibility to hidden, so we don't export all the Target classes


        


More information about the llvm-commits mailing list