llvm-project/clang/test
Akira Hatanaka 68ab7fe1c8 [CodeGenCXX] Fix ItaniumCXXABI::getAlignmentOfExnObject to return 8-byte
alignment on Darwin.

Itanium C++ ABI specifies that _Unwind_Exception should be double-word
aligned (16B). To conform to the ABI, libraries implementing exception
handling declare the struct with __attribute__((aligned)), which aligns
the unwindHeader field (and the end of __cxa_exception) to the default
target alignment (which is typically 16-bytes).

struct __cxa_exception {
  ...
  // struct is declared with __attribute__((aligned)).
  _Unwind_Exception unwindHeader;
};

Based on the assumption that _Unwind_Exception is declared with
__attribute__((aligned)), ItaniumCXXABI::getAlignmentOfExnObject returns
the target default alignment for __attribute__((aligned)). It turns out
that libc++abi, which is used on Darwin, doesn't declare the struct with
the attribute and therefore doesn't guarantee that unwindHeader is
aligned to the alignment specified by the ABI, which in some cases
causes the program to crash because of unaligned memory accesses.

This commit avoids crashes due to unaligned memory accesses by having
getAlignmentOfExnObject return an 8-byte alignment on Darwin. I've only
fixed the problem for Darwin, but we should also figure out whether other
platforms using libc++abi need similar fixes.

rdar://problem/25314277

Differential revision: http://reviews.llvm.org/D18479

llvm-svn: 264998
2016-03-31 06:36:07 +00:00
..
ARCMT Define weak and __weak to mean ARC-style weak references, even in MRC. 2015-10-22 18:38:17 +00:00
ASTMerge [ASTImporter] Implement missing VisitAccessSpecDecl function in ASTImporter class. 2016-02-18 23:08:36 +00:00
Analysis [analyzer] Use BodyFarm-synthesized body even when actual body available. 2016-03-28 23:55:58 +00:00
CXX Paper over the Windows-only enum initialization test failure until the bug is fixed 2016-03-28 20:13:55 +00:00
CodeCompletion Fix ObjCMethodDecl::findPropertyDecl for class properties. 2016-03-11 21:14:40 +00:00
CodeGen [SystemZ] Specify required features for builtins. 2016-03-30 15:51:24 +00:00
CodeGenCUDA [CUDA] Add -disable-llvm-passes to CodeGenCUDA/link-device-bitcode.cu. NFC 2016-03-30 23:45:38 +00:00
CodeGenCXX [CodeGenCXX] Fix ItaniumCXXABI::getAlignmentOfExnObject to return 8-byte 2016-03-31 06:36:07 +00:00
CodeGenObjC Revert "Convert some ObjC msgSends to runtime calls." 2016-03-21 20:50:03 +00:00
CodeGenObjCXX Mangle extended qualifiers in the proper order and mangle the 2016-03-01 22:18:03 +00:00
CodeGenOpenCL AMDGPU: Add frexp_mant + frexp_exp builtins 2016-03-30 22:57:40 +00:00
Coverage Stop messing with the 'g' group of options in CompilerInvocation. 2015-10-08 04:24:12 +00:00
CoverageMapping [Coverage] Fix the start/end locations of switch statements 2016-03-04 08:07:15 +00:00
Driver [DarwinDriver] Increase the number of valid digits for ld64 version string. 2016-03-31 02:45:46 +00:00
FixIt [Lit Test] Updated 26 Lit tests to be C++11 compatible. 2015-11-11 19:34:47 +00:00
Format Fix clang-format test. I believe that the new behavior is better. 2015-11-23 08:50:52 +00:00
Frontend clang-cl: Include /FI headers in /showIncludes output. 2016-03-23 18:00:22 +00:00
Headers D18325: Added mm_malloc module export. 2016-03-22 20:57:51 +00:00
Index [index] Remove redundancy between symbol kind and language 2016-03-25 17:01:59 +00:00
Integration
Layout [MS] Fix for bug 25013 - #pragma vtordisp is unknown inside functions, by Denis Zobnin. 2015-11-20 07:02:57 +00:00
Lexer Update cxx-features test to C++1z 2016-03-22 21:12:48 +00:00
Misc Fix Clang crash with template type diffing. 2016-03-30 22:23:00 +00:00
Modules [CrashReproducer] Add a module map callback for added headers 2016-03-30 23:54:25 +00:00
OpenMP [OPENMP 4.0] Initial support for '#pragma omp declare simd' directive. 2016-03-30 10:43:55 +00:00
PCH [Clang][ARM] __va_list declaration is not saved in ASTContext causing compilation error or crash 2016-03-30 21:30:30 +00:00
Parser [Cxx1z-constexpr-lambda-P0170R1] Support parsing of constexpr specifier (and its inference) on lambda expressions 2016-03-26 16:11:37 +00:00
Preprocessor [lanai] Add Lanai backend to clang driver. 2016-03-28 21:02:54 +00:00
Profile [PGO] Test case fix for r264783 2016-03-29 22:17:52 +00:00
Rewriter Stop messing with the 'g' group of options in CompilerInvocation. 2015-10-08 04:24:12 +00:00
Sema [Sema] Fix PR27122: ICE with enable_if+ill-formed call. 2016-03-31 00:16:25 +00:00
SemaCUDA [CUDA] Make unattributed constexpr functions implicitly host+device. 2016-03-30 23:30:21 +00:00
SemaCXX Fix -Wdynamic-class-memaccess to skip invalid classes. 2016-03-31 04:18:07 +00:00
SemaObjC [Sema] Attempt [3] to fix tests for utf-8 invalid format string specifiers 2016-03-29 21:30:58 +00:00
SemaObjCXX [ObjCXX] Warn undeclared identifiers. 2016-03-25 18:43:46 +00:00
SemaOpenCL [OpenCL] Fix pipe builtin bugs 2016-03-30 04:46:32 +00:00
SemaTemplate Add missing triple to instantiate-sizeof.cpp test 2016-03-11 19:17:53 +00:00
TableGen
Tooling int function without a return statement is invalid C++. 2015-11-27 18:10:49 +00:00
Unit
VFS [VFS] Fix status() of opened redirected file 2015-12-10 23:41:39 +00:00
.clang-format
CMakeLists.txt clang/test/Frontend/plugin-annotate-functions.c requires the target examples/AnnotateFunctions. 2016-03-21 11:03:39 +00:00
TestRunner.sh
cxx-sections.data
lit.cfg Revert r260266 (and r260276), "clang-cl: Enable plugins on Windows" 2016-02-11 16:43:08 +00:00
lit.site.cfg.in [modules] Compress files embedded into a .pcm file, to reduce the disk usage of -fembed-all-files mode. 2016-02-06 02:06:43 +00:00
make_test_dirs.pl