Revert "[libc++] Remove workarounds for systems that used to require __need_XXX macros"
This reverts commit 119cef40d18c48240854edc553dca61c4e9fdf27.
The change broke multiple builders.
NOKEYCHECK=True
GitOrigin-RevId: 3f65c8fcbe4ed4886500a0b9b939a363b70a43c3
diff --git a/include/stdlib.h b/include/stdlib.h
index 1c990c1..64581b6 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -7,7 +7,15 @@
//
//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP_STDLIB_H
+#if defined(__need_malloc_and_calloc)
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#include_next <stdlib.h>
+
+#elif !defined(_LIBCPP_STDLIB_H)
#define _LIBCPP_STDLIB_H
/*