1 Index: libffi/ChangeLog
2 ===================================================================
3 --- libffi.orig/ChangeLog
7 2011-02-09 Anthony Green <green@moxielogic.com>
9 - * README: Mention ARM iOS.
10 + * testsuite/libffi.call/err_bad_typedef.c: Remove xfail.
11 + * testsuite/libffi.call/err_bad_abi.c: Remove xfail.
12 + * src/x86/ffi64.c (UNLIKELY, LIKELY): Define.
13 + (ffi_prep_closure_loc): Check for bad ABI.
14 + * src/prep_cif.c (UNLIKELY, LIKELY): Define.
15 + (initialize_aggregate): Check for bad types.
17 2011-02-09 Landon Fuller <landonf@macports.org>
20 * src/closures.c: Handle FFI_EXEC_TRAMPOLINE_TABLE case.
21 * build-ios.sh: New file.
22 * fficonfig.h.in, configure, Makefile.in: Rebuilt.
23 + * README: Mention ARM iOS.
25 2011-02-08 Oren Held <orenhe@il.ibm.com>
27 Index: libffi/src/prep_cif.c
28 ===================================================================
29 --- libffi.orig/src/prep_cif.c
30 +++ libffi/src/prep_cif.c
32 /* -----------------------------------------------------------------------
33 - prep_cif.c - Copyright (c) 2012 Anthony Green
34 + prep_cif.c - Copyright (c) 2011, 2012 Anthony Green
35 Copyright (c) 1996, 1998, 2007 Red Hat, Inc.
37 Permission is hereby granted, free of charge, to any person obtaining
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 @@ -46,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 @@ -95,10 +105,11 @@ ffi_status ffi_prep_cif(ffi_cif *cif, ff
68 FFI_ASSERT(cif != NULL);
70 - FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI));
71 + if ((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI))
74 - FFI_ASSERT(abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI
75 - || abi == FFI_THISCALL);
76 + if (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI || abi == FFI_THISCALL)
81 Index: libffi/src/x86/ffi64.c
82 ===================================================================
83 --- libffi.orig/src/x86/ffi64.c
84 +++ libffi/src/x86/ffi64.c
87 #include <ffi_common.h>
90 +#define __builtin_expect(x, expected_value) (x)
92 +#define LIKELY(x) __builtin_expect((x),1)
93 +#define UNLIKELY(x) __builtin_expect((x),1)
98 @@ -498,6 +504,13 @@ ffi_prep_closure_loc (ffi_closure* closu
100 volatile unsigned short *tramp;
102 + /* Sanity check on the cif ABI. */
104 + int abi = cif->abi;
105 + if (UNLIKELY (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI)))
106 + return FFI_BAD_ABI;
109 tramp = (volatile unsigned short *) &closure->tramp[0];
111 tramp[0] = 0xbb49; /* mov <code>, %r11 */
112 Index: libffi/testsuite/libffi.call/err_bad_abi.c
113 ===================================================================
114 --- libffi.orig/testsuite/libffi.call/err_bad_abi.c
115 +++ libffi/testsuite/libffi.call/err_bad_abi.c
118 Originator: Blake Chaffin 6/6/2007 */
120 -/* { dg-do run { xfail *-*-* } } */
126 Index: libffi/testsuite/libffi.call/err_bad_typedef.c
127 ===================================================================
128 --- libffi.orig/testsuite/libffi.call/err_bad_typedef.c
129 +++ libffi/testsuite/libffi.call/err_bad_typedef.c
132 Originator: Blake Chaffin 6/6/2007 */
134 -/* { dg-do run { xfail *-*-* } } */