[PATCH] D62813: [HWASAN][CMake] Allow instrumenting LLVM/clang

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 08:52:05 PDT 2019


evgeny777 created this revision.
evgeny777 added reviewers: kcc, eugenis.
Herald added a subscriber: mgorny.

One can't simply pass -fsanitize=hwaddress to CFLAGS, because DSOs will fail to link due to -Wl,-z,defs being passed to linker


https://reviews.llvm.org/D62813

Files:
  cmake/modules/HandleLLVMOptions.cmake


Index: cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -697,6 +697,9 @@
     if (LLVM_USE_SANITIZER STREQUAL "Address")
       append_common_sanitizer_flags()
       append("-fsanitize=address" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+    elseif (LLVM_USE_SANITIZER STREQUAL "HWAddress")
+      append_common_sanitizer_flags()
+      append("-fsanitize=hwaddress" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
     elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?")
       append_common_sanitizer_flags()
       append("-fsanitize=memory" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62813.202727.patch
Type: text/x-patch
Size: 699 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190603/51d89731/attachment.bin>


More information about the llvm-commits mailing list