diff --git a/libcxx/src/new.cpp b/libcxx/src/new.cpp index 1fb4b2da40d7..3ad593a3c0e0 100644 --- a/libcxx/src/new.cpp +++ b/libcxx/src/new.cpp @@ -11,6 +11,10 @@ #include "new" +#ifndef __has_include +#define __has_include(inc) 0 +#endif + #if __APPLE__ #include @@ -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() + #include + #endif // __has_include() + #ifndef _LIBCPPABI_VERSION + static std::new_handler __new_handler; + #endif // _LIBCPPABI_VERSION #endif // Implement all new and delete operators as weak definitions diff --git a/libcxx/src/typeinfo.cpp b/libcxx/src/typeinfo.cpp index cfc64ef57a61..6bab0771f427 100644 --- a/libcxx/src/typeinfo.cpp +++ b/libcxx/src/typeinfo.cpp @@ -7,8 +7,15 @@ // //===----------------------------------------------------------------------===// #include + +#ifndef __has_include +#define __has_include(inc) 0 +#endif + #if __APPLE__ #include +#elif defined(LIBCXXRT) || __has_include() +#include #endif #include "typeinfo"