mirror of
https://github.com/siemens-mobile-hacks/llvm-c166.git
synced 2026-11-25 21:45:57 +00:00
Required by #196388 In preparation for asan's operator new throwing `std::bad_alloc` on OOM, compile the C++ slice (asan_new_delete.cpp, the only asan TU that throws) with -frtti instead of the -fno-rtti inherited from ASAN_CFLAGS. Throwing `std::bad_alloc` needs the type_info for std::bad_alloc. Under -fno-rtti clang cannot reference the C++ ABI library's canonical _ZTISt9bad_alloc and instead emits a private, hidden per-image copy of it. On Mach-O that copy does not coalesce with the definition in libc++abi, so the type_info the runtime throws with differs from the one the user's `catch (const std::bad_alloc&)` matches against, and the program terminates. On ELF the copy is weak with default visibility, so the linker coalesces every copy to one and the addresses match, but that coalescing is not guaranteed (e.g. `-Bsymbolic` defeats it). Building this one TU with -frtti makes clang reference the external canonical type_info, so the runtime's throw and the user's catch agree on every platform. The change lives inside the existing exceptions carve-out, so it only takes effect when the throwing path is compiled in, and it adds no new library dependency (the exception throw already requires the C++ ABI library). |
||
|---|---|---|
| .. | ||
| cmake | ||
| docs | ||
| include | ||
| lib | ||
| resources | ||
| test | ||
| tools | ||
| unittests | ||
| utils | ||
| www | ||
| .clang-tidy | ||
| .gitignore | ||
| CMakeLists.txt | ||
| CREDITS.TXT | ||
| LICENSE.TXT | ||
| Maintainers.md | ||
| README.txt | ||
Compiler-RT ================================ This directory and its subdirectories contain source code for the compiler support routines. Compiler-RT is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt. ================================