[libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memor...
authorIgor Kudrin <ikudrin.dev@gmail.com>
Thu, 29 Sep 2016 06:38:06 +0000 (06:38 +0000)
committerIgor Kudrin <ikudrin.dev@gmail.com>
Thu, 29 Sep 2016 06:38:06 +0000 (06:38 +0000)
commit962750b511e8c5d00967cbb69d7350b70f57b2d0
tree51b4ad899cdf4793d1a13e75c9d8a59a3d5cea7e
parent1b60e9d7c0e704031e91cb254d680e1a47712a62
[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.

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

llvm-svn: 282692
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