Index: src/new.cpp
===================================================================
--- src/new.cpp	(revision 160783)
+++ src/new.cpp	(working copy)
@@ -11,6 +11,10 @@
 
 #include "new"
 
+#ifndef __has_include
+#define __has_include(inc) 0
+#endif
+
 #if __APPLE__
     #include <cxxabi.h>
 
@@ -21,7 +25,12 @@
         #define __new_handler __cxxabiapple::__cxa_new_handler
     #endif
 #else  // __APPLE__
-    static std::new_handler __new_handler;
+    #if defined(LIBCXXRT) || __has_include(<cxxabi.h>)
+        #include <cxxabi.h>
+    #endif  // __has_include(<cxxabi.h>)
+    #ifndef _LIBCPPABI_VERSION
+        static std::new_handler __new_handler;
+    #endif  // _LIBCPPABI_VERSION
 #endif
 
 // Implement all new and delete operators as weak definitions
Index: src/typeinfo.cpp
===================================================================
--- src/typeinfo.cpp	(revision 160783)
+++ src/typeinfo.cpp	(working copy)
@@ -7,8 +7,15 @@
 //
 //===----------------------------------------------------------------------===//
 #include <stdlib.h>
+
+#ifndef __has_include
+#define __has_include(inc) 0
+#endif
+
 #if __APPLE__
 #include <cxxabi.h>
+#elif defined(LIBCXXRT) || __has_include(<cxxabi.h>)
+#include <cxxabi.h>
 #endif
 
 #include "typeinfo"
