Index: include/llvm/Support/Registry.h =================================================================== --- include/llvm/Support/Registry.h +++ include/llvm/Support/Registry.h @@ -135,16 +135,20 @@ // 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)); + } } } } - /// Retrieve the data to be passed across DLL boundaries when /// importing registries from another DLL on Windows. static void *exportRegistry() {