diff --git lib/CodeGen/CGDeclCXX.cpp lib/CodeGen/CGDeclCXX.cpp
index 10f0b83..32a234e 100644
--- lib/CodeGen/CGDeclCXX.cpp
+++ lib/CodeGen/CGDeclCXX.cpp
@@ -234,7 +234,8 @@ static void emitGlobalDtorWithAtExit(CodeGenFunction &CGF,
 void CodeGenFunction::EmitCXXGlobalDtorRegistration(llvm::Constant *dtor,
                                                     llvm::Constant *addr) {
   // Use __cxa_atexit if available.
-  if (CGM.getCodeGenOpts().CXAAtExit) {
+  if (CGM.getCodeGenOpts().CXAAtExit &&
+      CGM.getContext().getTargetInfo().getCXXABI() != CXXABI_Microsoft) {
     emitGlobalDtorWithCXAAtExit(*this, dtor, addr);
     return;
   }
diff --git lib/CodeGen/MicrosoftCXXABI.cpp lib/CodeGen/MicrosoftCXXABI.cpp
index 825e041..ac1f514 100644
--- lib/CodeGen/MicrosoftCXXABI.cpp
+++ lib/CodeGen/MicrosoftCXXABI.cpp
@@ -85,10 +85,25 @@ public:
     CGF.CGM.ErrorUnsupported(expr, "don't know how to handle array cookies "
                                    "in the Microsoft C++ ABI");
   }
+
+  virtual void EmitGuardedInit(CodeGenFunction &CGF, const VarDecl &D,
+                               llvm::GlobalVariable *DeclPtr,
+                               bool PerformInit);
 };
 
 }
 
+void MicrosoftCXXABI::EmitGuardedInit(CodeGenFunction &CGF, const VarDecl &D,
+                                      llvm::GlobalVariable *DeclPtr,
+                                      bool PerformInit) {
+  // FIXME: this code was only tested for global initialization.
+  // Not sure whether we want thread-safe static local variables as VS
+  // doesn't make them thread-safe.
+
+  // Emit the initializer and add a global destructor if appropriate.
+  CGF.EmitCXXGlobalVarDeclInit(D, DeclPtr, PerformInit);
+}
+
 CGCXXABI *clang::CodeGen::CreateMicrosoftCXXABI(CodeGenModule &CGM) {
   return new MicrosoftCXXABI(CGM);
 }
diff --git test/CodeGenCXX/microsoft-abi-static-initializers.cpp test/CodeGenCXX/microsoft-abi-static-initializers.cpp
new file mode 100644
index 0000000..0e3bf0b
--- /dev/null
+++ test/CodeGenCXX/microsoft-abi-static-initializers.cpp
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+
+struct S {
+  S() {}
+  ~S() {}
+} s;
+
+// CHECK: define internal void [[INIT_s:@.*global_var.*]] nounwind
+// CHECK: call void @"\01??0S@@QAE@XZ"
+// CHECK: call i32 @atexit(void ()* @"__dtor_\01?s@@3US@@A")
+// CHECK: ret void
+
+// CHECK: define internal void @"__dtor_\01?s@@3US@@A"() nounwind {
+// CHECK: call void @"\01??1S@@QAE@XZ"
+// CHECK: ret void
+
+// Force WeakODRLinkage by using templates
+class A {
+ public:
+  A() {}
+  ~A() {}
+};
+
+template<typename T>
+class B {
+ public:
+  static A foo;
+};
+
+template<typename T> A B<T>::foo;
+
+void force_usage() {
+  (void)B<int>::foo;  // (void) - force usage
+}
+
+// CHECK: define internal void [[INIT_foo:@.*global_var.*]] nounwind
+// CHECK: call void @"\01??0A@@QAE@XZ"
+// CHECK: call i32 @atexit(void ()* [[FOO_DTOR:@"__dtor_.*foo@.*]])
+// CHECK: ret void
+
+// CHECK: define linkonce_odr void @"\01??0A@@QAE@XZ"
+
+// CHECK: define linkonce_odr void @"\01??1A@@QAE@XZ"
+
+// CHECK: define internal void [[FOO_DTOR]]
+// CHECK: call void @"\01??1A@@QAE@XZ"{{.*}}foo
+// CHECK: ret void
+
+// CHECK: call void [[INIT_s]]
+// CHECK: call void [[INIT_foo]]
