Commit 9af445fd70e4d7f2b3bdfc511cc3cc76a6b84c9a

Kevin Bowling 2022-05-23T18:05:01

Upstream FreeBSD riscv patch (#708) Like 8276f812a99b10d1f2c387dbd6ef2ca4f597c733 commit message: > devel/libffi: Fix abort() on ARM related to __clear_cache() > > The current FreeBSD __clear_cache() implementation does nothing #if > __i386__ || __x86_64__ #else abort(); > > cognet@ advises this is an issue for anything !Apple that is using the > libcompiler_rt provided by Clang on ARM, and requires upstreaming. Co-authored-by: Kristof Provost <kp@FreeBSD.org>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/riscv/ffi.c b/src/riscv/ffi.c
index ebd05ba..f08191d 100644
--- a/src/riscv/ffi.c
+++ b/src/riscv/ffi.c
@@ -442,7 +442,9 @@ ffi_status ffi_prep_closure_loc(ffi_closure *closure, ffi_cif *cif, void (*fun)(
     closure->fun = fun;
     closure->user_data = user_data;
 
+#if !defined(__FreeBSD__)
     __builtin___clear_cache(codeloc, codeloc + FFI_TRAMPOLINE_SIZE);
+#endif
 
     return FFI_OK;
 }