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

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 20 13:38:14 PDT 2022


mstorsjo created this revision.
mstorsjo added reviewers: rnk, mati865, jeremyd2019.
Herald added subscribers: hiraditya, mgorny.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

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 <https://reviews.llvm.org/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.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130200

Files:
  llvm/lib/Target/CMakeLists.txt


Index: llvm/lib/Target/CMakeLists.txt
===================================================================
--- llvm/lib/Target/CMakeLists.txt
+++ llvm/lib/Target/CMakeLists.txt
@@ -22,6 +22,7 @@
 # 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130200.446254.patch
Type: text/x-patch
Size: 572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220720/81fcc11c/attachment.bin>


More information about the llvm-commits mailing list