Skip to content

Commit

Permalink
libffi: fix darwin powerpc build
Browse files Browse the repository at this point in the history
disable go bindings as they are not supported
on darwin powerpc at present

enable tests

closes: https://trac.macports.org/ticket/61153
  • Loading branch information
kencu committed Sep 11, 2020
1 parent 4cadb80 commit 5287b4e
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
6 changes: 6 additions & 0 deletions devel/libffi/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ checksums rmd160 2cd43b66d792f1bad76df2e19a8411beacfcb8e0 \
sha256 72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056 \
size 1305466

patchfiles patch-libffi-darwin-powerpc-no-go-closures.diff

# Don't use macports gcc or clang toolchains to build this due to dependency cycles
compiler.blacklist-append macports-*

Expand Down Expand Up @@ -52,4 +54,8 @@ lappend merger_dont_diff \
${prefix}/include/ffi.h \
${prefix}/include/ffitarget.h

depends_test-append port:expect port:dejagnu
test.run yes
test.target check

github.livecheck.regex {(\d+(?:\.\d+)+)}
84 changes: 84 additions & 0 deletions devel/libffi/files/patch-libffi-darwin-powerpc-no-go-closures.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
diff --git src/powerpc/ffi_darwin.c src/powerpc/ffi_darwin.c
index 61a18c4..64bb94d 100644
--- src/powerpc/ffi_darwin.c
+++ src/powerpc/ffi_darwin.c
@@ -33,7 +33,10 @@
#include <stdlib.h>

extern void ffi_closure_ASM (void);
+
+#if defined (FFI_GO_CLOSURES)
extern void ffi_go_closure_ASM (void);
+#endif

enum {
/* The assembly depends on these exact flags.
@@ -909,8 +912,10 @@ ffi_prep_cif_machdep (ffi_cif *cif)
extern void ffi_call_AIX(extended_cif *, long, unsigned, unsigned *,
void (*fn)(void), void (*fn2)(void));

+#if defined (FFI_GO_CLOSURES)
extern void ffi_call_go_AIX(extended_cif *, long, unsigned, unsigned *,
void (*fn)(void), void (*fn2)(void), void *closure);
+#endif

extern void ffi_call_DARWIN(extended_cif *, long, unsigned, unsigned *,
void (*fn)(void), void (*fn2)(void), ffi_type*);
@@ -950,6 +955,7 @@ ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
}
}

+#if defined (FFI_GO_CLOSURES)
void
ffi_call_go (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue,
void *closure)
@@ -981,6 +987,7 @@ ffi_call_go (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue,
break;
}
}
+#endif

static void flush_icache(char *);
static void flush_range(char *, int);
@@ -1110,6 +1117,7 @@ ffi_prep_closure_loc (ffi_closure* closure,
return FFI_OK;
}

+#if defined (FFI_GO_CLOSURES)
ffi_status
ffi_prep_go_closure (ffi_go_closure* closure,
ffi_cif* cif,
@@ -1133,6 +1141,7 @@ ffi_prep_go_closure (ffi_go_closure* closure,
}
return FFI_OK;
}
+#endif

static void
flush_icache(char *addr)
@@ -1168,9 +1177,11 @@ ffi_type *
ffi_closure_helper_DARWIN (ffi_closure *, void *,
unsigned long *, ffi_dblfl *);

+#if defined (FFI_GO_CLOSURES)
ffi_type *
ffi_go_closure_helper_DARWIN (ffi_go_closure*, void *,
unsigned long *, ffi_dblfl *);
+#endif

/* Basically the trampoline invokes ffi_closure_ASM, and on
entry, r11 holds the address of the closure.
@@ -1430,6 +1441,7 @@ ffi_closure_helper_DARWIN (ffi_closure *closure, void *rvalue,
closure->user_data, rvalue, pgr, pfr);
}

+#if defined (FFI_GO_CLOSURES)
ffi_type *
ffi_go_closure_helper_DARWIN (ffi_go_closure *closure, void *rvalue,
unsigned long *pgr, ffi_dblfl *pfr)
@@ -1437,4 +1449,4 @@ ffi_go_closure_helper_DARWIN (ffi_go_closure *closure, void *rvalue,
return ffi_closure_helper_common (closure->cif, closure->fun,
closure, rvalue, pgr, pfr);
}
-
+#endif

0 comments on commit 5287b4e

Please sign in to comment.