#include <stdio.h>
#endif
+#ifndef __SANITIZE_ADDRESS__
+# ifdef __clang__
+# if __has_feature(address_sanitizer)
+# define FFI_ASAN
+# endif
+# endif
+#endif
+#ifdef __SANITIZE_ADDRESS__
+#define FFI_ASAN
+#endif
+
+#ifdef FFI_ASAN
+#define FFI_ASAN_NO_SANITIZE __attribute__((no_sanitize_address))
+#else
+#define FFI_ASAN_NO_SANITIZE
+#endif
+
#ifdef FFI_DEBUG
NORETURN void ffi_assert(const char *expr, const char *file, int line);
void ffi_stop_here(void);
void *closure) FFI_HIDDEN;
/* Call a function with the provided arguments and capture the return
- value. */
+ value.
+ n.b. ffi_call_SYSV will steal the alloca'd `stack` variable here for use
+ _as its own stack_ - so we need to compile this function without ASAN */
+FFI_ASAN_NO_SANITIZE
static void
ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
void **avalue, void *closure)
#if defined(_MSC_VER)
#pragma runtime_checks("s", off)
#endif
+/* n.b. ffi_call_unix64 will steal the alloca'd `stack` variable here for use
+ _as its own stack_ - so we need to compile this function without ASAN */
+FFI_ASAN_NO_SANITIZE
static void
ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
void **avalue, void *closure)
return FFI_OK;
}
+/* n.b. ffi_call_unix64 will steal the alloca'd `stack` variable here for use
+ _as its own stack_ - so we need to compile this function without ASAN */
+FFI_ASAN_NO_SANITIZE
static void
ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
void **avalue, void *closure)