[libcxxabi] r342815 - Fix incorrectly aligned exceptions in 32 bit builds.

Eric Fiselier eric at efcs.ca
Sat Sep 22 12:22:37 PDT 2018


Author: ericwf
Date: Sat Sep 22 12:22:36 2018
New Revision: 342815

URL: http://llvm.org/viewvc/llvm-project?rev=342815&view=rev
Log:
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.

Modified:
    libcxxabi/trunk/src/fallback_malloc.cpp

Modified: libcxxabi/trunk/src/fallback_malloc.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/fallback_malloc.cpp?rev=342815&r1=342814&r2=342815&view=diff
==============================================================================
--- libcxxabi/trunk/src/fallback_malloc.cpp (original)
+++ libcxxabi/trunk/src/fallback_malloc.cpp Sat Sep 22 12:22:36 2018
@@ -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>




More information about the libcxx-commits mailing list