diff options
author | Konstantin Varlamov <varconst@apple.com> | 2022-02-11 11:56:29 -0800 |
---|---|---|
committer | Louis Dionne <ldionne.2@gmail.com> | 2022-02-15 15:16:41 -0500 |
commit | dfc24b8522ba9943e20bc4162d42d6b49bf85214 (patch) | |
tree | 5d05861c62c119f51454870005d082f2d4007ffc | |
parent | 199e05e34bb8beb1cafce3a086932a32c493fa13 (diff) | |
download | llvm-dfc24b8522ba9943e20bc4162d42d6b49bf85214.zip llvm-dfc24b8522ba9943e20bc4162d42d6b49bf85214.tar.gz llvm-dfc24b8522ba9943e20bc4162d42d6b49bf85214.tar.bz2 |
[libc++][NFC] Work around false positive ODR violations from ASan.
This works around a known issue in ASan. ASan doesn't instrument weak
symbols. Because instrumentation increases object size, the binary can
end up with two versions of the same object, one instrumented and one
not instrumented, with different sizes, which ASan will report as an ODR
violation. In libc++, this affects typeinfo for `std::bad_function_call`
which is emitted as a weak symbol in the test executable and as a strong
symbol in the shared library.
The main open issue for ASan appears to be
https://github.com/google/sanitizers/issues/1017.
Differential Revision: https://reviews.llvm.org/D119410
(cherry picked from commit 10953974ed6b61247fd4b070b3a6e390e02d0edb)
-rw-r--r-- | libcxx/cmake/caches/Generic-asan.cmake | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libcxx/cmake/caches/Generic-asan.cmake b/libcxx/cmake/caches/Generic-asan.cmake index cf91976..a86b347 100644 --- a/libcxx/cmake/caches/Generic-asan.cmake +++ b/libcxx/cmake/caches/Generic-asan.cmake @@ -1 +1,3 @@ set(LLVM_USE_SANITIZER "Address" CACHE STRING "") +# This is a temporary (hopefully) workaround for an ASan issue (see https://llvm.org/D119410). +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mllvm -asan-use-private-alias=1" CACHE INTERNAL "") |