Cleanup symbol exports on darwin and add architecture preprocessor checks to assist in building fat binaries (eg: i386+x86_64 on macOS or arm+aarch64 on iOS) (#450)

* x86: Ensure _efi64 suffixed symbols are not exported

* x86: Ensure we do not export ffi_prep_cif_machdep

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* x86: Ensure we don't export ffi_call_win64, ffi_closure_win64, or ffi_go_closure_win64

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* closures: Silence a semantic warning

libffi/src/closures.c:175:23: This function declaration is not a prototype

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* aarch64: Ensure we don't export ffi_prep_cif_machdep

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* arm: Ensure we don't export ffi_prep_cif_machdep

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* aarch64, arm, x86: Add architecture preprocessor checks to support easier fat builds (eg: iOS)

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* x86: Silence some static analysis warnings

libffi/src/x86/ffi64.c:286:21: The left operand of '!=' is a garbage value due to array index out of bounds
libffi/src/x86/ffi64.c:297:22: The left operand of '!=' is a garbage value due to array index out of bounds

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* aarch: Use FFI_HIDDEN rather than .hidden

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

* ffi.h: Don't advertise ffi_java_rvalue_to_raw, ffi_prep_java_raw_closure, and ffi_prep_java_raw_closure_loc when FFI_NATIVE_RAW_API is 0

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
This commit is contained in:
Jeremy Huddleston Sequoia
2019-02-19 07:11:28 -05:00
committed by Anthony Green
parent 3ec522bc1c
commit 05a1796419
11 changed files with 44 additions and 22 deletions
+7 -4
View File
@@ -19,6 +19,7 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifdef __arm64__
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@@ -454,7 +455,7 @@ allocate_int_to_reg_or_stack (struct call_context *context,
return allocate_to_stack (state, stack, size, size);
}
ffi_status
ffi_status FFI_HIDDEN
ffi_prep_cif_machdep (ffi_cif *cif)
{
ffi_type *rtype = cif->rtype;
@@ -539,9 +540,9 @@ ffi_prep_cif_machdep (ffi_cif *cif)
#if defined (__APPLE__)
/* Perform Apple-specific cif processing for variadic calls */
ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif,
unsigned int nfixedargs,
unsigned int ntotalargs)
ffi_status FFI_HIDDEN
ffi_prep_cif_machdep_var(ffi_cif *cif, unsigned int nfixedargs,
unsigned int ntotalargs)
{
ffi_status status = ffi_prep_cif_machdep (cif);
cif->aarch64_nfixedargs = nfixedargs;
@@ -943,3 +944,5 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
return flags;
}
#endif /* __arm64__ */
+8 -6
View File
@@ -19,6 +19,7 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifdef __arm64__
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
@@ -198,9 +199,9 @@ CNAME(ffi_call_SYSV):
cfi_endproc
.globl CNAME(ffi_call_SYSV)
FFI_HIDDEN(CNAME(ffi_call_SYSV))
#ifdef __ELF__
.type CNAME(ffi_call_SYSV), #function
.hidden CNAME(ffi_call_SYSV)
.size CNAME(ffi_call_SYSV), .-CNAME(ffi_call_SYSV)
#endif
@@ -237,9 +238,9 @@ CNAME(ffi_closure_SYSV_V):
cfi_endproc
.globl CNAME(ffi_closure_SYSV_V)
FFI_HIDDEN(CNAME(ffi_closure_SYSV_V))
#ifdef __ELF__
.type CNAME(ffi_closure_SYSV_V), #function
.hidden CNAME(ffi_closure_SYSV_V)
.size CNAME(ffi_closure_SYSV_V), . - CNAME(ffi_closure_SYSV_V)
#endif
@@ -349,9 +350,9 @@ CNAME(ffi_closure_SYSV):
cfi_endproc
.globl CNAME(ffi_closure_SYSV)
FFI_HIDDEN(CNAME(ffi_closure_SYSV))
#ifdef __ELF__
.type CNAME(ffi_closure_SYSV), #function
.hidden CNAME(ffi_closure_SYSV)
.size CNAME(ffi_closure_SYSV), . - CNAME(ffi_closure_SYSV)
#endif
@@ -369,9 +370,9 @@ CNAME(ffi_closure_trampoline_table_page):
.endr
.globl CNAME(ffi_closure_trampoline_table_page)
FFI_HIDDEN(CNAME(ffi_closure_trampoline_table_page))
#ifdef __ELF__
.type CNAME(ffi_closure_trampoline_table_page), #function
.hidden CNAME(ffi_closure_trampoline_table_page)
.size CNAME(ffi_closure_trampoline_table_page), . - CNAME(ffi_closure_trampoline_table_page)
#endif
#endif
@@ -396,9 +397,9 @@ CNAME(ffi_go_closure_SYSV_V):
cfi_endproc
.globl CNAME(ffi_go_closure_SYSV_V)
FFI_HIDDEN(CNAME(ffi_go_closure_SYSV_V))
#ifdef __ELF__
.type CNAME(ffi_go_closure_SYSV_V), #function
.hidden CNAME(ffi_go_closure_SYSV_V)
.size CNAME(ffi_go_closure_SYSV_V), . - CNAME(ffi_go_closure_SYSV_V)
#endif
@@ -425,12 +426,13 @@ CNAME(ffi_go_closure_SYSV):
cfi_endproc
.globl CNAME(ffi_go_closure_SYSV)
FFI_HIDDEN(CNAME(ffi_go_closure_SYSV))
#ifdef __ELF__
.type CNAME(ffi_go_closure_SYSV), #function
.hidden CNAME(ffi_go_closure_SYSV)
.size CNAME(ffi_go_closure_SYSV), . - CNAME(ffi_go_closure_SYSV)
#endif
#endif /* FFI_GO_CLOSURES */
#endif /* __arm64__ */
#if defined __ELF__ && defined __linux__
.section .note.GNU-stack,"",%progbits