aboutsummaryrefslogtreecommitdiff
path: root/lib/libunwind/src/libunwind.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-10-02 10:45:56 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-10-02 10:45:56 -0700
commitdde0adcb363f3a3f306c0fc9eaec511cc3b74965 (patch)
tree9388d039a0b77211936c7264f5a3179f63ad51e6 /lib/libunwind/src/libunwind.cpp
parentc4cd592f0e1eeff5a4056796610d97010ae4e38c (diff)
parent7a2624c3e40e2386a4a8a775b839e1d67608ec42 (diff)
downloadzig-dde0adcb363f3a3f306c0fc9eaec511cc3b74965.tar.gz
zig-dde0adcb363f3a3f306c0fc9eaec511cc3b74965.zip
Merge branch 'llvm13'
Diffstat (limited to 'lib/libunwind/src/libunwind.cpp')
-rw-r--r--lib/libunwind/src/libunwind.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/libunwind/src/libunwind.cpp b/lib/libunwind/src/libunwind.cpp
index c21461b1f4..1faf000ce4 100644
--- a/lib/libunwind/src/libunwind.cpp
+++ b/lib/libunwind/src/libunwind.cpp
@@ -16,6 +16,15 @@
#include <stdlib.h>
+// 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
#if !defined(__USING_SJLJ_EXCEPTIONS__)
#include "AddressSpace.hpp"
@@ -60,7 +69,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
# warning The MIPS architecture is not supported with this ABI and environment!
#elif defined(__sparc__)
# define REGISTER_KIND Registers_sparc
-#elif defined(__riscv) && __riscv_xlen == 64
+#elif defined(__riscv)
# define REGISTER_KIND Registers_riscv
#elif defined(__ve__)
# define REGISTER_KIND Registers_ve
@@ -184,6 +193,10 @@ _LIBUNWIND_WEAK_ALIAS(__unw_get_proc_info, unw_get_proc_info)
/// 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) || defined(__SANITIZE_ADDRESS__)
+ // Inform the ASan runtime that now might be a good time to clean stuff up.
+ __asan_handle_no_return();
+#endif
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
co->jumpto();
return UNW_EUNSPEC;