Index: llvm/cmake/modules/AddLLVM.cmake =================================================================== --- llvm/cmake/modules/AddLLVM.cmake +++ llvm/cmake/modules/AddLLVM.cmake @@ -855,7 +855,17 @@ string(TOUPPER ${name} name_upper) - option(LLVM_${name_upper}_LINK_INTO_TOOLS "Statically link ${name} into tools (if available)" OFF) + if (WIN32) + # Dynamically linked pass plugins are not supported on Windows: the plugin + # DLL needs to specify for each symbol from the LLVM framework from which + # file it is imported, which in case of statically linked executables is + # different for each tool (opt, bugpoint, clang, ...). + # See llvm/lib/Transforms/Hello for an example that can be + # loaded (only) into opt.exe. + set(LLVM_${name_upper}_LINK_INTO_TOOLS ON) + else () + option(LLVM_${name_upper}_LINK_INTO_TOOLS "Statically link ${name} into tools (if available)" OFF) + endif () # process_llvm_pass_plugins takes care of the actual linking, just create an # object library as of now