Changeset View
Changeset View
Standalone View
Standalone View
head/devel/libffi/files/patch-src__arm__ffi.c
# Description: Fix abort() on ARM related to __clear_cache(). This is an issue | # Description: Fix abort() on ARM related to __clear_cache(). This is an issue | ||||
# for anything !apple that is using the libcompiler_rt provided by clang on ARM | # for anything !apple that is using the libcompiler_rt provided by clang on ARM | ||||
# PR: ports/149167 ports/184517 | # PR: ports/149167 ports/184517 | ||||
# Patch by: cognet@ (to be upstreamed @ LLVM) | # Patch by: cognet@ (to be upstreamed @ LLVM) | ||||
--- ./src/arm/ffi.c.orig 2013-03-16 22:19:39.000000000 +1100 | --- src/arm/ffi.c.orig 2019-10-31 14:49:54 UTC | ||||
+++ ./src/arm/ffi.c 2013-12-03 19:30:58.440924300 +1100 | +++ src/arm/ffi.c | ||||
@@ -33,6 +33,11 @@ | @@ -55,6 +55,11 @@ extern unsigned int ffi_arm_trampoline[3] FFI_HIDDEN; | ||||
#endif | |||||
#endif | |||||
#include <stdlib.h> | |||||
+#if defined(__FreeBSD__) && defined(__arm__) | +#if defined(__FreeBSD__) && defined(__arm__) | ||||
+#include <sys/types.h> | +#include <sys/types.h> | ||||
+#include <machine/sysarch.h> | +#include <machine/sysarch.h> | ||||
+#endif | +#endif | ||||
+ | + | ||||
/* Forward declares. */ | /* Forward declares. */ | ||||
static int vfp_type_p (ffi_type *); | static int vfp_type_p (const ffi_type *); | ||||
static void layout_vfp_args (ffi_cif *); | static void layout_vfp_args (ffi_cif *); | ||||
@@ -582,6 +587,16 @@ | @@ -568,6 +573,16 @@ void ffi_go_closure_SYSV (void) FFI_HIDDEN; | ||||
void ffi_go_closure_VFP (void) FFI_HIDDEN; | |||||
#else | /* the cif must already be prep'ed */ | ||||
+ | |||||
+#if defined(__FreeBSD__) && defined(__arm__) | +#if defined(__FreeBSD__) && defined(__arm__) | ||||
+#define __clear_cache(start, end) do { \ | +#define __clear_cache(start, end) do { \ | ||||
+ struct arm_sync_icache_args ua; \ | + struct arm_sync_icache_args ua; \ | ||||
+ \ | + \ | ||||
+ ua.addr = (uintptr_t)(start); \ | + ua.addr = (uintptr_t)(start); \ | ||||
+ ua.len = (char *)(end) - (char *)start; \ | + ua.len = (char *)(end) - (char *)start; \ | ||||
+ sysarch(ARM_SYNC_ICACHE, &ua); \ | + sysarch(ARM_SYNC_ICACHE, &ua); \ | ||||
+ } while (0); | + } while (0); | ||||
+#endif | +#endif | ||||
+ | |||||
#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ | ffi_status | ||||
({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ | ffi_prep_closure_loc (ffi_closure * closure, | ||||
unsigned int __fun = (unsigned int)(FUN); \ |