Index: lib/CodeGen/CodeGenModule.cpp =================================================================== --- lib/CodeGen/CodeGenModule.cpp +++ lib/CodeGen/CodeGenModule.cpp @@ -2398,8 +2398,10 @@ } // Handle dropped DLL attributes. - if (D && !D->hasAttr() && !D->hasAttr()) + if (D && !D->hasAttr() && !D->hasAttr()) { Entry->setDLLStorageClass(llvm::GlobalValue::DefaultStorageClass); + setDSOLocal(Entry); + } // If there are two attempts to define the same mangled name, issue an // error. Index: test/CodeGenCXX/dllimport.cpp =================================================================== --- test/CodeGenCXX/dllimport.cpp +++ test/CodeGenCXX/dllimport.cpp @@ -203,6 +203,8 @@ // Functions //===----------------------------------------------------------------------===// +// GNU-DAG: declare dso_local void @_ZdlPv(i8*) + // Import function declaration. // MSC-DAG: declare dllimport void @"?decl@@YAXXZ"() // GNU-DAG: declare dllimport void @_Z4declv()