diff --git a/clang/lib/Interpreter/CMakeLists.txt b/clang/lib/Interpreter/CMakeLists.txt index 84f6ca5271d2a..9065f998f73c4 100644 --- a/clang/lib/Interpreter/CMakeLists.txt +++ b/clang/lib/Interpreter/CMakeLists.txt @@ -38,3 +38,14 @@ add_clang_library(clangInterpreter clangSema clangSerialization ) + +if ((MINGW OR CYGWIN) AND BUILD_SHARED_LIBS) + # The DLLs are supposed to export all symbols (except for ones that are + # explicitly hidden). Normally, this is what happens anyway, but if there + # are symbols that are marked explicitly as dllexport, we'd only export them + # and nothing else. The Interpreter contains a few cases of such dllexports + # (for symbols that need to be exported even from standalone exe files); + # therefore, add --export-all-symbols to make sure we export all symbols + # despite potential dllexports. + target_link_options(clangInterpreter PRIVATE LINKER:--export-all-symbols) +endif()