diff options
author | Eric Fiselier <eric@efcs.ca> | 2018-09-22 22:22:36 +0300 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2018-09-22 22:22:36 +0300 |
commit | 4b47cbccd453c089f0a1d1699dd80718943986d0 (patch) | |
tree | 71306c3c9231d833894879598c21ab0e16d3718a /libcxxabi/src/fallback_malloc.cpp | |
parent | 931d66cd2216e27b76b70d63592212245a1689bd (diff) |
Fix incorrectly aligned exceptions in 32 bit builds.
This patch fixes a bug where exceptions in 32 bit builds
would be incorrectly aligned because malloc only provides 8 byte aligned
memory where 16 byte alignment is needed.
This patch makes libc++abi correctly use posix_memalign when it's
available. This requires defining _LIBCPP_BUILDING_LIBRARY so that
libc++ only defines _LIBCPP_HAS_NO_ALIGNED_ALLOCATION when libc doesn't
support it and not when aligned new/delete are disable for other
reasons.
This bug somehow made it into the 7.0 release, making it a regression.
Therefore this patch should be included in the next dot release.
llvm-svn: 342815
Diffstat (limited to 'libcxxabi/src/fallback_malloc.cpp')
-rw-r--r-- | libcxxabi/src/fallback_malloc.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libcxxabi/src/fallback_malloc.cpp b/libcxxabi/src/fallback_malloc.cpp index 336ad31b0176..bec9952596bf 100644 --- a/libcxxabi/src/fallback_malloc.cpp +++ b/libcxxabi/src/fallback_malloc.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Define _LIBCPP_BUILDING_LIBRARY to ensure _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +// is only defined when libc aligned allocation is not available. +#define _LIBCPP_BUILDING_LIBRARY #include "fallback_malloc.h" #include <__threading_support> |