Nick Hutchinson 46de320038
[compiler-rt][rtsan] Fix build failures when building against in-tree libc++ (#175638)
When building compiler-rt against an in-tree libc++, intermittent build
failures could occur: some rtsan sources referenced c++ stdlib includes
(i.e. `#include <new>`), but there was no CMake dependency enforcing
that the libc++ headers were copied into place before the rtsan sources
were built.

https://github.com/llvm/llvm-project/issues/127764#issue-2862550745
proposed adding the dependency on the `cxx-headers` target to resolve
the issue. But my understanding is that compiler-rt sanitizer runtimes
aren't expected to bring in C++ stdlib includes in the first place --
`SANITIZER_COMMON_CFLAGS`, used by the other sanitizer runtimes,
contains `-nostdinc++`.

Rtsan only included `<new>` to get support for placement new.
`sanitizer_common/sanitizer_placement_new.h` can provide this without
the need for C++ stdlib headers.

Move from `COMPILER_RT_COMMON_CFLAGS`/`COMPILER_RT_CXX_CFLAGS` to
`SANITIZER_COMMON_CFLAGS`, and from `COMPILER_RT_COMMON_LINK_FLAGS` to
`SANITIZER_COMMON_LINK_FLAGS` to be consistent with the other
sanitizers.

Fixes #127764.
2026-01-14 11:18:30 -08:00
..