[libcxxabi] Fix alignment of allocated exceptions in 32 bit builds
Summary:
In 32 bit builds on a 64 bit system `std::malloc` does not return correctly aligned memory. This leads to undefined behavior.
This patch switches to using `posix_memalign` to allocate correctly aligned memory instead.
Reviewers: mclow.lists, danalbert, jroelofs, compnerd
Reviewed By: compnerd
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25417
llvm-svn: 296952
diff --git a/libcxxabi/src/fallback_malloc.h b/libcxxabi/src/fallback_malloc.h
index cb2c843..d6f4714 100644
--- a/libcxxabi/src/fallback_malloc.h
+++ b/libcxxabi/src/fallback_malloc.h
@@ -16,11 +16,12 @@
namespace __cxxabiv1 {
// Allocate some memory from _somewhere_
-_LIBCXXABI_HIDDEN void * __malloc_with_fallback(size_t size);
+_LIBCXXABI_HIDDEN void * __aligned_malloc_with_fallback(size_t size);
// Allocate and zero-initialize memory from _somewhere_
_LIBCXXABI_HIDDEN void * __calloc_with_fallback(size_t count, size_t size);
+_LIBCXXABI_HIDDEN void __aligned_free_with_fallback(void *ptr);
_LIBCXXABI_HIDDEN void __free_with_fallback(void *ptr);
} // namespace __cxxabiv1