diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index cb768a476143..18e472f3017e 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -313,7 +313,7 @@ macro(add_clang_library name) target_link_libraries( ${name} ${LLVM_COMMON_LIBS} ) link_system_libs( ${name} ) - if (SHARED_LIBRARY AND LLVM_EXPORTED_SYMBOL_FILE) + if ((SHARED_LIBRARY OR MODULE) AND LLVM_EXPORTED_SYMBOL_FILE) add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} ) endif() diff --git a/clang/examples/PrintFunctionNames/CMakeLists.txt b/clang/examples/PrintFunctionNames/CMakeLists.txt index 492b580c0ea6..95f1b6b25a62 100644 --- a/clang/examples/PrintFunctionNames/CMakeLists.txt +++ b/clang/examples/PrintFunctionNames/CMakeLists.txt @@ -4,6 +4,14 @@ set( LLVM_LINK_COMPONENTS Support ) +# If we don't need RTTI or EH, there's no reason to export anything +# from the hello plugin. +if( NOT LLVM_REQUIRES_RTTI ) + if( NOT LLVM_REQUIRES_EH ) + set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/PrintFunctionNames.exports) + endif() +endif() + add_clang_library(PrintFunctionNames PrintFunctionNames.cpp) add_dependencies(PrintFunctionNames