[cfe-dev] Why does Xcode define _LIBCPP_HAS_NO_ASAN when enabling address sanitizer?
Sean McBride via cfe-dev
cfe-dev at lists.llvm.org
Mon Aug 8 17:20:01 PDT 2016
On Mon, 8 Aug 2016 23:59:19 +0100, Jonathan Coe via cfe-dev said:
>Turning on address sanitizer in Xcode 7 passes the compile and linker flag
>-fsanitize=address and also defines _LIBCPP_HAS_NO_ASAN.
>When building my library from the command line and running tests on a
>sanitized build without defining _LIBCPP_HAS_NO_ASAN I see non-repeatable
>address-sanitizer-reported memory access issues. Defining
>_LIBCPP_HAS_NO_ASAN, as Xcode does, gets rid of the sanitizer issues but
>I'm curious as to why it needs doing.
>Why do I need to define _LIBCPP_HAS_NO_ASAN with AppleClang7 to avoid
>getting memory access issues in libcxx?
I believe it was as a result of this thread:
That is: otherwise you'd get false positives if you linked to some C++ libs not themselves built with ASan. As of Xcode 7.3 there is the CLANG_ADDRESS_SANITIZER_CONTAINER_OVERFLOW build option.
Sean McBride, B. Eng sean at rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
More information about the cfe-dev