From 9c3f6fda10049080f883072255059ffacb3c8c7e Mon Sep 17 00:00:00 2001 From: Valentin Haenel Date: Thu, 17 Jun 2021 17:10:32 +0200 Subject: [PATCH] don't export LLVM symbols on OSX too As title --- ffi/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ffi/CMakeLists.txt b/ffi/CMakeLists.txt index df870da6d..6e9322ad8 100755 --- a/ffi/CMakeLists.txt +++ b/ffi/CMakeLists.txt @@ -64,4 +64,12 @@ target_link_libraries(llvmlite ${llvm_libs}) # -flto and --exclude-libs allow us to remove those parts of LLVM we don't use if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") set_property(TARGET llvmlite APPEND_STRING PROPERTY LINK_FLAGS "-flto -Wl,--exclude-libs,ALL") +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(LLVM_EXCLUDE_SYMBOLS "-Wl,-unexported_symbol,__ZTVN4llvm* \ + -Wl,-unexported_symbol,__ZNK4llvm* \ + -Wl,-unexported_symbol,__ZN4llvm* \ + -Wl,-unexported_symbol,__ZTIN4llvm* \ + -Wl,-unexported_symbol,_LLVM* \ + -Wl,-unexported_symbol,__ZTSN4llvm*") + set_property(TARGET llvmlite APPEND_STRING PROPERTY LINK_FLAGS "${LLVM_SYMBOLS_AVOID}") endif()