From d4e5a96c23f089639037e3d210e74a0bcab95ef6 Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Fri, 29 Jan 2021 19:46:01 +0100 Subject: [PATCH] config-internal.h: automatically set ECL_C_COMPATIBLE_VARIADIC_DISPATCH for apple/arm64 --- INSTALL | 2 +- src/h/config-internal.h.in | 9 +++++++++ src/h/object.h | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL index 3a3b8e35..8f9efed1 100644 --- a/INSTALL +++ b/INSTALL @@ -98,7 +98,7 @@ Hint provided by Pascal J. Bourguignon. #+END_SRC 3. Build and install the target library #+BEGIN_SRC shell-script - export CFLAGS="$CFLAGS -DECL_C_COMPATIBLE_VARIADIC_DISPATCH -DGC_DISABLE_INCREMENTAL -DECL_RWLOCK" + export CFLAGS="$CFLAGS -DGC_DISABLE_INCREMENTAL -DECL_RWLOCK" export CXXFLAGS="$CFLAGS" ./configure --host=aarch64-apple-darwin \ --prefix=`pwd`/ecl-iOS \ diff --git a/src/h/config-internal.h.in b/src/h/config-internal.h.in index 6b4438ad..fe36e7f0 100644 --- a/src/h/config-internal.h.in +++ b/src/h/config-internal.h.in @@ -248,3 +248,12 @@ #else #define ECL_DEFAULT_C_STACK_SIZE @ECL_DEFAULT_C_STACK_SIZE@ #endif + +/* Do the fixed and optional arguments of a variadic function use a + * different calling convention? + * Hardcoded since there's no easy way to determine this from a + * configure check and currently ARM64 apple is the only platform + * known to do this. */ +#if defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) +#define ECL_C_COMPATIBLE_VARIADIC_DISPATCH +#endif diff --git a/src/h/object.h b/src/h/object.h index 3ab8a6c8..69023bc9 100644 --- a/src/h/object.h +++ b/src/h/object.h @@ -769,7 +769,7 @@ struct ecl_cfun { /* compiled function header */ cl_object block; /* descriptor of C code block for GC */ cl_objectfn entry; /* entry address */ #ifdef ECL_C_COMPATIBLE_VARIADIC_DISPATCH - /* Some architectures (i.e. ARM64 on iOS) use a different + /* Some architectures (i.e. ARM64 on iOS/Mac OS X) use a different * calling convention for the fixed and variadic arguments of * a variadic function. The only portable way to allow for * function redefinitions during runtime in these