[PATCH] D60235: [CMake] Disable libc++ and libc++abi new/delete definitions when built with ASan

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 3 15:41:10 PDT 2019


phosek created this revision.
phosek added a reviewer: mcgrathr.
Herald added subscribers: cfe-commits, dexonsmith, mehdi_amini, mgorny.
Herald added a reviewer: EricWF.
Herald added a project: clang.

ASan provides its own operator new/delete to intercept all allocations
and deallocations. Currently, they rely on overriding weak symbols that
are already provided by libc++abi and libc++, but that solution is
fragile and breaks in certain scenarios, e.g. when libc++abi is
statically linked into a shared libc++.

Rather we should avoid providing new/delete operators when built with
ASan altogether and rely on new/delete operators provided by the
sanitizer runtime.


Repository:
  rC Clang

https://reviews.llvm.org/D60235

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===================================================================
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -142,6 +142,9 @@
     set(RUNTIMES_${target}-fuchsia_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF CACHE BOOL "")
     set(RUNTIMES_${target}-fuchsia_LIBCXX_ABI_VERSION 2 CACHE STRING "")
 
+    set(RUNTIMES_${target}-fuchsia-asan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
+    set(RUNTIMES_${target}-fuchsia-asan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
+
     # Use .build-id link.
     list(APPEND RUNTIME_BUILD_ID_LINK "${target}-fuchsia")
   endforeach()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60235.193612.patch
Type: text/x-patch
Size: 701 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190403/18813090/attachment.bin>


More information about the cfe-commits mailing list