[PATCH] D104176: [libunwind] Define and use portable macro for checking for presence of ASAN
Saleem Abdulrasool via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 13 14:46:28 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe03be2efe564: unwind: allow building with GCC (authored by compnerd).
Changed prior to commit:
https://reviews.llvm.org/D104176?vs=351711&id=351743#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104176/new/
https://reviews.llvm.org/D104176
Files:
libunwind/src/libunwind.cpp
Index: libunwind/src/libunwind.cpp
===================================================================
--- libunwind/src/libunwind.cpp
+++ libunwind/src/libunwind.cpp
@@ -16,7 +16,13 @@
#include <stdlib.h>
-#if __has_feature(address_sanitizer)
+// Define the __has_feature extension for compilers that do not support it so
+// that we can later check for the presence of ASan in a compiler-neutral way.
+#if !defined(__has_feature)
+#define __has_feature(feature) 0
+#endif
+
+#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
#include <sanitizer/asan_interface.h>
#endif
@@ -187,7 +193,7 @@
/// Resume execution at cursor position (aka longjump).
_LIBUNWIND_HIDDEN int __unw_resume(unw_cursor_t *cursor) {
_LIBUNWIND_TRACE_API("__unw_resume(cursor=%p)", static_cast<void *>(cursor));
-#if __has_feature(address_sanitizer)
+#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
// Inform the ASan runtime that now might be a good time to clean stuff up.
__asan_handle_no_return();
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104176.351743.patch
Type: text/x-patch
Size: 1045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210613/3491a37e/attachment.bin>
More information about the llvm-commits
mailing list