Index: cmake/modules/HandleLLVMOptions.cmake =================================================================== --- cmake/modules/HandleLLVMOptions.cmake +++ cmake/modules/HandleLLVMOptions.cmake @@ -643,12 +643,4 @@ # Plugin support # FIXME: Make this configurable. -if(WIN32 OR CYGWIN) - if(BUILD_SHARED_LIBS) - set(LLVM_ENABLE_PLUGINS ON) - else() - set(LLVM_ENABLE_PLUGINS OFF) - endif() -else() - set(LLVM_ENABLE_PLUGINS ON) -endif() +set(LLVM_ENABLE_PLUGINS ON) Index: include/llvm/Support/Registry.h =================================================================== --- include/llvm/Support/Registry.h +++ include/llvm/Support/Registry.h @@ -135,12 +135,17 @@ // current Registry. typedef std::pair Info; Info *I = static_cast(Getter()); - iterator begin(I->first); - iterator end(I->second); - for (++end; begin != end; ++begin) { - // This Node object needs to remain alive for the - // duration of the program. - add_node(new node(*begin)); + // We need to check I->first != Head for mingw, which build DLLs + // sharing extern symbols when using LLVM_BUILD_SHARED, so we don't + // copy the Registry in itself. + if (I->first != nullptr && I->first != Head) { + iterator begin(I->first); + iterator end(I->second); + for (++end; begin != end; ++begin) { + // This Node object needs to remain alive for the + // duration of the program. + add_node(new node(*begin)); + } } } }