[llvm] Initial changes for llvm shared library build using explicit visibility annotations (PR #96630)

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 07:25:21 PDT 2024


================
@@ -125,18 +126,79 @@
 #define LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
 #endif
 
-
-#if (!(defined(_WIN32) || defined(__CYGWIN__)) ||                              \
-     (defined(__MINGW32__) && defined(__clang__)))
-#define LLVM_LIBRARY_VISIBILITY LLVM_ATTRIBUTE_VISIBILITY_HIDDEN
 #if defined(LLVM_BUILD_LLVM_DYLIB) || defined(LLVM_BUILD_SHARED_LIBS)
 #define LLVM_EXTERNAL_VISIBILITY LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
 #else
 #define LLVM_EXTERNAL_VISIBILITY
 #endif
+
+#if (!(defined(_WIN32) || defined(__CYGWIN__)) ||                              \
+     (defined(__MINGW32__) && defined(__clang__)))
+#define LLVM_LIBRARY_VISIBILITY LLVM_ATTRIBUTE_VISIBILITY_HIDDEN
+#define LLVM_ALWAYS_EXPORT LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
----------------
compnerd wrote:

Explicitly spelling out the attribute OSS what I was suggesting. On Linux, protected visibility has interesting behavior where symbols are not interpositionable and are externally visible. Using that is potentially useful for load times on Linux for exported symbols.

https://github.com/llvm/llvm-project/pull/96630


More information about the llvm-commits mailing list