Revert "[libcxxabi] Always use thread_local for cxa_exception_storage"
This reverts commit 8271aa5335668a1dc62168a4e90b4554bd3a0ca7 since it
broke some downstream builds. See https://reviews.llvm.org/D138461 for
details.
NOKEYCHECK=True
GitOrigin-RevId: bc91104e85b7a233a8966998f387b2222f350f6e
diff --git a/src/fallback_malloc.cpp b/src/fallback_malloc.cpp
index 759bb58..591efbe 100644
--- a/src/fallback_malloc.cpp
+++ b/src/fallback_malloc.cpp
@@ -270,6 +270,17 @@
return fallback_malloc(size);
}
+void* __calloc_with_fallback(size_t count, size_t size) {
+ void* ptr = ::calloc(count, size);
+ if (NULL != ptr)
+ return ptr;
+ // if calloc fails, fall back to emergency stash
+ ptr = fallback_malloc(size * count);
+ if (NULL != ptr)
+ ::memset(ptr, 0, size * count);
+ return ptr;
+}
+
void __aligned_free_with_fallback(void* ptr) {
if (is_fallback_ptr(ptr))
fallback_free(ptr);