Recommit r282692: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in...
authorIgor Kudrin <ikudrin.dev@gmail.com>
Fri, 7 Oct 2016 08:48:28 +0000 (08:48 +0000)
committerIgor Kudrin <ikudrin.dev@gmail.com>
Fri, 7 Oct 2016 08:48:28 +0000 (08:48 +0000)
commitd9edde4ae2cd3e5350c3a981f6715de9f2457196
tree5a54ba1c78820fd881b810ed2fa670a029ddb5e4
parent4df1cc0b00f7ee72a1841de2080d9a4f7a1a6955
Recommit r282692: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.

Throwing an exception for the first time may lead to call calloc to
allocate memory for __cxa_eh_globals. If the memory pool is exhausted
at that moment, it results in abnormal termination of the program.

This patch addresses the issue by using fallback_malloc in that case.

In this revision, some restrictions were added into the test to not
run it in unsuitable environments.

Differential Revision: https://reviews.llvm.org/D17815

llvm-svn: 283531
libcxxabi/src/CMakeLists.txt
libcxxabi/src/cxa_exception.cpp
libcxxabi/src/cxa_exception_storage.cpp
libcxxabi/src/fallback_malloc.cpp [moved from libcxxabi/src/fallback_malloc.ipp with 82% similarity]
libcxxabi/src/fallback_malloc.h [new file with mode: 0644]
libcxxabi/test/test_exception_storage_nodynmem.pass.cpp [new file with mode: 0644]
libcxxabi/test/test_fallback_malloc.pass.cpp