[all-commits] [llvm/llvm-project] c5c335: [asan] Fix asan_new_delete.cpp C++ header resoluti...
Justin T. Gibbs via All-commits
all-commits at lists.llvm.org
Wed Jun 10 09:54:34 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c5c33597bfdba185a6f8d04c0330e386a2e52abf
https://github.com/llvm/llvm-project/commit/c5c33597bfdba185a6f8d04c0330e386a2e52abf
Author: Justin T. Gibbs <gibbs at scsiguy.com>
Date: 2026-06-10 (Wed, 10 Jun 2026)
Changed paths:
M compiler-rt/lib/asan/CMakeLists.txt
Log Message:
-----------
[asan] Fix asan_new_delete.cpp C++ header resolution under -nostdinc++ (#202816)
The COMPILER_RT_ASAN_ENABLE_EXCEPTIONS gate in asan/CMakeLists.txt
enables -fexceptions on the C++ slice (RTAsan_cxx /
RTAsan_dynamic_cxx — asan_new_delete.cpp) and tries to expose C++
standard headers to that TU (for forthcoming std::bad_alloc support)
by stripping -nostdinc++ from its cflags. The strip works for native
standalone builds but is wrong for cross builds: the host C++ headers
aren't valid for the target.
Split the C++-slice flag handling into two paths inside the existing
EXCEPTIONS gate:
* In-tree libc++ available (TARGET cxx-headers OR HAVE_LIBCXX):
keep -nostdinc++, append ${COMPILER_RT_CXX_CFLAGS} (a generator
expression that expands to "-isystem <prepared cxx-headers dir>"),
and add cxx-headers to DEPS so the header tree is staged before
the compile. Mirrors the pattern in orc / fuzzer / memprof /
tsan / xray.
* No in-tree libc++ (typical standalone build): drop -nostdinc++
for the C++ slice TU only so the host toolchain supplies C++ headers.
Reject COMPILER_RT_CXX_LIBRARY=none +
COMPILER_RT_ASAN_ENABLE_EXCEPTIONS=ON
at configure time: that combination opts out of any C++ stdlib while
asking for an exception-enabled C++ slice, silently leaking host headers
into a `none`-mode build.
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