[compiler-rt] [asan] Build the asan_new_delete.cpp C++ slice with -frtti (PR #213077)
Justin T. Gibbs via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 12:06:06 PDT 2026
================
@@ -188,6 +188,16 @@ if(COMPILER_RT_ASAN_ENABLE_EXCEPTIONS AND COMPILER_RT_HAS_FEXCEPTIONS_FLAG)
list(APPEND ASAN_CXX_CFLAGS -fexceptions)
list(REMOVE_ITEM ASAN_DYNAMIC_CXX_CFLAGS -fno-exceptions)
list(APPEND ASAN_DYNAMIC_CXX_CFLAGS -fexceptions)
+ # The throwing operator new throws std::bad_alloc. Under -fno-rtti clang emits a
+ # private type_info copy a user `catch` can't match on Mach-O. ELF avoids this
+ # only via linker coalescing of the weak copies, which is not guaranteed
+ # (e.g. defeated by `-Bsymbolic`). Build with -frtti to use libc++abi's copy.
+ if(COMPILER_RT_HAS_FRTTI_FLAG)
+ list(REMOVE_ITEM ASAN_CXX_CFLAGS -fno-rtti)
+ list(APPEND ASAN_CXX_CFLAGS -frtti)
----------------
scsiguy wrote:
I had to add a 'remove_rtti_flags' macro to execute the "remove then add" idiom that is followed throughout compiler-rt/lllvm. Hope that's ok.
https://github.com/llvm/llvm-project/pull/213077
More information about the llvm-commits
mailing list