summaryrefslogtreecommitdiffstats
path: root/js/src/ctypes/libffi-patches/03-asan.patch
blob: c28a850f2d43a4c46e99ef2d0487e127dcdd2563 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff --git a/js/src/ctypes/libffi/src/x86/ffi64.c b/js/src/ctypes/libffi/src/x86/ffi64.c
index 5a5e043..0594119 100644
--- a/js/src/ctypes/libffi/src/x86/ffi64.c
+++ b/js/src/ctypes/libffi/src/x86/ffi64.c
@@ -414,16 +414,26 @@ ffi_prep_cif_machdep (ffi_cif *cif)
   if (ssecount)
     flags |= 1 << 11;
   cif->flags = flags;
   cif->bytes = (unsigned)ALIGN (bytes, 8);
 
   return FFI_OK;
 }
 
+#ifndef __SANITIZE_ADDRESS__
+# ifdef __clang__
+#  if __has_feature(address_sanitizer)
+#   define __SANITIZE_ADDRESS__
+#  endif
+# endif
+#endif
+#ifdef __SANITIZE_ADDRESS__
+__attribute__((noinline,no_sanitize_address))
+#endif
 void
 ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
 {
   enum x86_64_reg_class classes[MAX_CLASSES];
   char *stack, *argp;
   ffi_type **arg_types;
   int gprcount, ssecount, ngpr, nsse, i, avn;
   _Bool ret_in_memory;