summaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxxabi/src/stdlib_new_delete.cpp
diff options
context:
space:
mode:
authordtorilov <[email protected]>2023-05-24 20:01:25 +0300
committerdtorilov <[email protected]>2023-05-24 20:01:25 +0300
commitf14549c83decddd1c8634ce32c8616ebb654c5a3 (patch)
tree5e016684f9d81eed049e148cf99f6a111410cdef /contrib/libs/cxxsupp/libcxxabi/src/stdlib_new_delete.cpp
parent39b4a50f6cc323d60f9cee1b3e3f55e1df2dd9bd (diff)
YT-19142: Add emscripten patches to libcxxabi
Diffstat (limited to 'contrib/libs/cxxsupp/libcxxabi/src/stdlib_new_delete.cpp')
-rw-r--r--contrib/libs/cxxsupp/libcxxabi/src/stdlib_new_delete.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/libs/cxxsupp/libcxxabi/src/stdlib_new_delete.cpp b/contrib/libs/cxxsupp/libcxxabi/src/stdlib_new_delete.cpp
index 4a664e15a50..48e509ba2b3 100644
--- a/contrib/libs/cxxsupp/libcxxabi/src/stdlib_new_delete.cpp
+++ b/contrib/libs/cxxsupp/libcxxabi/src/stdlib_new_delete.cpp
@@ -37,9 +37,17 @@ operator new(std::size_t size) _THROW_BAD_ALLOC
else
#ifndef _LIBCXXABI_NO_EXCEPTIONS
throw std::bad_alloc();
+#ifdef __EMSCRIPTEN__
+ // Abort here so that when exceptions are disabled, we do not just
+ // return 0 when malloc returns 0.
+ // We could also do this with set_new_handler, but that adds a
+ // global constructor and a table entry, overhead that we can avoid
+ // by doing it this way.
+ abort();
#else
break;
#endif
+#endif
}
return p;
}