mstorsjo added inline comments.
================ Comment at: lib/CodeGen/CodeGenModule.cpp:737 + // potentially could come from another DLL as DSO local. + if (GV->hasExternalLinkage() && GV->isDeclaration() && + isa<llvm::GlobalVariable>(GV) && !GV->isThreadLocal()) ---------------- rnk wrote: > I think this linkage and declaration check should be > `GV->isDeclarationForLinker()`, since that will catch `available_externally` > globals as well. Those would come from a static data member of a class > template that has an explicit instantiation declaration: > ``` > template <typename T> > struct Foo { > static const int x = 42; > }; > extern template struct Foo<int>; > const int *bar() { > return &Foo<int>::x; > } > ``` > Yep, that does it on x86_64-windows-gnu. We probably want a stub for > `Foo<int>::x`. > > Can you add a test at clang/test/CodeGenCXX/dso-local.cpp for this? Sure, will do. Repository: rC Clang https://reviews.llvm.org/D51382 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits