[all-commits] [llvm/llvm-project] 8b4599: [asan] Enable exceptions for asan_new_delete.cpp t...

Justin T. Gibbs via All-commits all-commits at lists.llvm.org
Mon Jun 8 11:02:50 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8b45994309c19752dd369e86487461f93c00532b
      https://github.com/llvm/llvm-project/commit/8b45994309c19752dd369e86487461f93c00532b
  Author: Justin T. Gibbs <gibbs at scsiguy.com>
  Date:   2026-06-08 (Mon, 08 Jun 2026)

  Changed paths:
    M compiler-rt/cmake/config-ix.cmake
    M compiler-rt/lib/asan/CMakeLists.txt

  Log Message:
  -----------
  [asan] Enable exceptions for asan_new_delete.cpp translation unit (#200719)

Groundwork for #196388.

Preparation for a follow-up change that lets the throwing operator new
wrappers in asan_new_delete.cpp throw std::bad_alloc on OOM. To support
that, asan_new_delete.cpp must be compiled with -fexceptions and must be
able to include <new> (i.e. without -nostdinc++). The rest of the ASan
runtime stays compiled with -fno-exceptions and -nostdinc++.

NOTE: Comments in CMakeLists.txt are written assuming the follow-on
      changes to use exceptions land, thus avoiding the need to update
      this file again.

Build-system changes:

* Define ASAN_CXX_CFLAGS as ASAN_CFLAGS minus -fno-exceptions and
-nostdinc++ plus -fexceptions. Define ASAN_DYNAMIC_CXX_CFLAGS likewise
relative to ASAN_DYNAMIC_CFLAGS. RTTI stays disabled; libstdc++ /
libc++abi supply the bad_alloc typeinfo.

* Static build: switch RTAsan_cxx (which already contains only
${ASAN_CXX_SOURCES} = asan_new_delete.cpp) from ASAN_CFLAGS to
ASAN_CXX_CFLAGS. RTAsan (the C slice) is unchanged.

* Dynamic build: split the previous single RTAsan_dynamic object library
into two — RTAsan_dynamic keeps ${ASAN_SOURCES} (no change in flags) and
a new RTAsan_dynamic_cxx carries ${ASAN_CXX_SOURCES} with
ASAN_DYNAMIC_CXX_CFLAGS. Both shared clang_rt.asan link rules pull in
RTAsan_dynamic_cxx alongside RTAsan_dynamic so the linked .so retains
the same set of object files; only the compile flags for
asan_new_delete.cpp change.

NFC at runtime — the asan_new_delete.cpp source as of this commit does
not yet use exceptions or include <new>, so the new flags are inert. The
follow-up commit makes use of them.

Assisted by: Claude Opus 4.7



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list