1 Index: libffi/ChangeLog
2 ===================================================================
3 --- libffi.orig/ChangeLog
6 2011-02-09 Anthony Green <green@moxielogic.com>
8 - * README: Mention ARM iOS.
9 + * testsuite/libffi.call/err_bad_typedef.c: Remove xfail.
10 + * testsuite/libffi.call/err_bad_abi.c: Remove xfail.
11 + * src/x86/ffi64.c (UNLIKELY, LIKELY): Define.
12 + (ffi_prep_closure_loc): Check for bad ABI.
13 + * src/prep_cif.c (UNLIKELY, LIKELY): Define.
14 + (initialize_aggregate): Check for bad types.
16 2011-02-09 Landon Fuller <landonf@macports.org>
19 * src/closures.c: Handle FFI_EXEC_TRAMPOLINE_TABLE case.
20 * build-ios.sh: New file.
21 * fficonfig.h.in, configure, Makefile.in: Rebuilt.
22 + * README: Mention ARM iOS.
24 2011-02-08 Oren Held <orenhe@il.ibm.com>
26 Index: libffi/src/prep_cif.c
27 ===================================================================
28 --- libffi.orig/src/prep_cif.c
29 +++ libffi/src/prep_cif.c
31 /* -----------------------------------------------------------------------
32 - prep_cif.c - Copyright (c) 1996, 1998, 2007 Red Hat, Inc.
33 + prep_cif.c - Copyright (c) 2011 Anthony Green
34 + Copyright (c) 1996, 1998, 2007 Red Hat, Inc.
36 Permission is hereby granted, free of charge, to any person obtaining
37 a copy of this software and associated documentation files (the
39 #include <ffi_common.h>
43 +#define __builtin_expect(x, expected_value) (x)
45 +#define LIKELY(x) __builtin_expect((x),1)
46 +#define UNLIKELY(x) __builtin_expect((x),1)
48 /* Round up to FFI_SIZEOF_ARG. */
50 #define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG)
51 @@ -45,9 +52,13 @@ static ffi_status initialize_aggregate(f
53 ptr = &(arg->elements[0]);
55 + if (UNLIKELY(ptr == 0))
56 + return FFI_BAD_TYPEDEF;
58 while ((*ptr) != NULL)
60 - if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK))
61 + if (UNLIKELY(((*ptr)->size == 0)
62 + && (initialize_aggregate((*ptr)) != FFI_OK)))
63 return FFI_BAD_TYPEDEF;
65 /* Perform a sanity check on the argument type */
66 @@ -93,7 +104,8 @@ ffi_status ffi_prep_cif(ffi_cif *cif, ff
69 FFI_ASSERT(cif != NULL);
70 - FFI_ASSERT(abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI);
71 + if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI))
75 cif->arg_types = atypes;
76 Index: libffi/src/x86/ffi64.c
77 ===================================================================
78 --- libffi.orig/src/x86/ffi64.c
79 +++ libffi/src/x86/ffi64.c
82 #include <ffi_common.h>
85 +#define __builtin_expect(x, expected_value) (x)
87 +#define LIKELY(x) __builtin_expect((x),1)
88 +#define UNLIKELY(x) __builtin_expect((x),1)
93 @@ -498,6 +504,13 @@ ffi_prep_closure_loc (ffi_closure* closu
95 volatile unsigned short *tramp;
97 + /* Sanity check on the cif ABI. */
100 + if (UNLIKELY (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI)))
101 + return FFI_BAD_ABI;
104 tramp = (volatile unsigned short *) &closure->tramp[0];
106 tramp[0] = 0xbb49; /* mov <code>, %r11 */
107 Index: libffi/testsuite/libffi.call/err_bad_abi.c
108 ===================================================================
109 --- libffi.orig/testsuite/libffi.call/err_bad_abi.c
110 +++ libffi/testsuite/libffi.call/err_bad_abi.c
113 Originator: Blake Chaffin 6/6/2007 */
115 -/* { dg-do run { xfail *-*-* } } */
121 Index: libffi/testsuite/libffi.call/err_bad_typedef.c
122 ===================================================================
123 --- libffi.orig/testsuite/libffi.call/err_bad_typedef.c
124 +++ libffi/testsuite/libffi.call/err_bad_typedef.c
127 Originator: Blake Chaffin 6/6/2007 */
129 -/* { dg-do run { xfail *-*-* } } */