forked from OSchip/llvm-project
Only define LLVM_EXTERNAL_VISIBILITY when building libLLVM dylib
When building LLVM static libraries, we should not make symbols more visible than CMAKE_CXX_VISIBILITY_PRESET, since the goal may be to have a purely hidden llvm embedded in another library. Instead, we only define LLVM_EXTERNAL_VISIBILITY for the dynamic library build (when LLVM_BUILD_LLVM_DYLIB=YES). Differential Revision: https://reviews.llvm.org/D113610
This commit is contained in:
parent
d4d76409d1
commit
71e97ad35b
|
@ -103,4 +103,7 @@
|
||||||
/* Define if the xar_open() function is supported on this platform. */
|
/* Define if the xar_open() function is supported on this platform. */
|
||||||
#cmakedefine LLVM_HAVE_LIBXAR ${LLVM_HAVE_LIBXAR}
|
#cmakedefine LLVM_HAVE_LIBXAR ${LLVM_HAVE_LIBXAR}
|
||||||
|
|
||||||
|
/* Define if building libLLVM shared library */
|
||||||
|
#cmakedefine LLVM_BUILD_LLVM_DYLIB
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -121,12 +121,16 @@
|
||||||
/// On PE/COFF targets, library visibility is the default, so this isn't needed.
|
/// On PE/COFF targets, library visibility is the default, so this isn't needed.
|
||||||
///
|
///
|
||||||
/// LLVM_EXTERNAL_VISIBILITY - classes, functions, and variables marked with
|
/// LLVM_EXTERNAL_VISIBILITY - classes, functions, and variables marked with
|
||||||
/// this attribute will be made public and visible outside of any shared library
|
/// this attribute will be made public and visible outside the libLLVM dynamic
|
||||||
/// they are linked in to.
|
/// library.
|
||||||
#if __has_attribute(visibility) && !defined(__MINGW32__) && \
|
#if __has_attribute(visibility) && !defined(__MINGW32__) && \
|
||||||
!defined(__CYGWIN__) && !defined(_WIN32)
|
!defined(__CYGWIN__) && !defined(_WIN32)
|
||||||
#define LLVM_LIBRARY_VISIBILITY __attribute__ ((visibility("hidden")))
|
#define LLVM_LIBRARY_VISIBILITY __attribute__ ((visibility("hidden")))
|
||||||
#define LLVM_EXTERNAL_VISIBILITY __attribute__ ((visibility("default")))
|
#if defined(LLVM_BUILD_LLVM_DYLIB)
|
||||||
|
#define LLVM_EXTERNAL_VISIBILITY __attribute__((visibility("default")))
|
||||||
|
#else
|
||||||
|
#define LLVM_EXTERNAL_VISIBILITY
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define LLVM_LIBRARY_VISIBILITY
|
#define LLVM_LIBRARY_VISIBILITY
|
||||||
#define LLVM_EXTERNAL_VISIBILITY
|
#define LLVM_EXTERNAL_VISIBILITY
|
||||||
|
|
Loading…
Reference in New Issue