Fix SPARC build, missing #include
[ghc-hetmet.git] / libffi / libffi.dllize-3.0.6.patch
1 diff -Nur libffi-3.0.6/Makefile.am build/Makefile.am
2 --- libffi-3.0.6/Makefile.am    2008-02-21 13:36:18.000000000 +0000
3 +++ build/Makefile.am   2009-01-23 17:56:09.000000000 +0000
4 @@ -165,7 +165,7 @@
5  
6  AM_CFLAGS = -Wall -g -fexceptions
7  
8 -libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
9 +libffi_la_LDFLAGS = $(LIBFFI_LDFLAGS) -version-info `grep -v '^\#' $(srcdir)/libtool-version`
10  
11  AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
12  AM_CCASFLAGS = $(AM_CPPFLAGS)
13 diff -Nur libffi-3.0.6/configure.ac build/configure.ac
14 --- libffi-3.0.6/configure.ac   2008-07-17 13:57:33.000000000 +0100
15 +++ build/configure.ac  2009-01-23 17:56:09.000000000 +0000
16 @@ -26,6 +26,20 @@
17  
18  AM_PROG_AS
19  AM_PROG_CC_C_O
20 +
21 +AC_LIBTOOL_WIN32_DLL
22 +AC_SUBST(LIBFFI_DLL,0)
23 +
24 +case $host in
25 +  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
26 +    if test "$enable_shared" = yes; then
27 +      LIBFFI_LDFLAGS="-no-undefined -Wl,--export-all-symbols"
28 +      LIBFFI_DLL=1
29 +    fi
30 +    ;;
31 +esac
32 +AC_SUBST(LIBFFI_LDFLAGS)
33 +
34  AC_PROG_LIBTOOL
35  
36  AM_MAINTAINER_MODE
37 diff -Nur libffi-3.0.6/include/ffi.h.in build/include/ffi.h.in
38 --- libffi-3.0.6/include/ffi.h.in       2008-04-03 19:57:34.000000000 +0100
39 +++ build/include/ffi.h.in      2009-01-23 17:56:09.000000000 +0000
40 @@ -61,6 +61,17 @@
41  #define @TARGET@
42  #endif
43  
44 +#if @LIBFFI_DLL@
45 +#ifdef DLL_EXPORT
46 +#define __FFI_DECLSPEC __declspec(__dllexport__)
47 +#else
48 +#define __FFI_DECLSPEC __declspec(__dllimport__)
49 +#endif
50 +#else
51 +#define __FFI_DECLSPEC
52 +#endif
53 +
54 +
55  /* ---- System configuration information --------------------------------- */
56  
57  #include <ffitarget.h>
58 @@ -223,27 +234,27 @@
59  #endif
60  
61  
62 -void ffi_raw_call (ffi_cif *cif,
63 -                  void (*fn)(void),
64 -                  void *rvalue,
65 -                  ffi_raw *avalue);
66 -
67 -void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
68 -void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
69 -size_t ffi_raw_size (ffi_cif *cif);
70 +__FFI_DECLSPEC void ffi_raw_call (ffi_cif *cif,
71 +                                 void (*fn)(void),
72 +                                 void *rvalue,
73 +                                 ffi_raw *avalue);
74 +
75 +__FFI_DECLSPEC void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
76 +__FFI_DECLSPEC void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
77 +__FFI_DECLSPEC size_t ffi_raw_size (ffi_cif *cif);
78  
79  /* This is analogous to the raw API, except it uses Java parameter     */
80  /* packing, even on 64-bit machines.  I.e. on 64-bit machines          */
81  /* longs and doubles are followed by an empty 64-bit word.             */
82  
83 -void ffi_java_raw_call (ffi_cif *cif,
84 -                       void (*fn)(void),
85 -                       void *rvalue,
86 -                       ffi_java_raw *avalue);
87 -
88 -void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
89 -void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
90 -size_t ffi_java_raw_size (ffi_cif *cif);
91 +__FFI_DECLSPEC void ffi_java_raw_call (ffi_cif *cif,
92 +                                      void (*fn)(void),
93 +                                      void *rvalue,
94 +                                      ffi_java_raw *avalue);
95 +
96 +__FFI_DECLSPEC void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
97 +__FFI_DECLSPEC void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
98 +__FFI_DECLSPEC size_t ffi_java_raw_size (ffi_cif *cif);
99  
100  /* ---- Definitions for closures ----------------------------------------- */
101  
102 @@ -256,16 +267,16 @@
103    void      *user_data;
104  } ffi_closure __attribute__((aligned (8)));
105  
106 -void *ffi_closure_alloc (size_t size, void **code);
107 -void ffi_closure_free (void *);
108 +__FFI_DECLSPEC void *ffi_closure_alloc (size_t size, void **code);
109 +__FFI_DECLSPEC void ffi_closure_free (void *);
110  
111 -ffi_status
112 +__FFI_DECLSPEC ffi_status
113  ffi_prep_closure (ffi_closure*,
114                   ffi_cif *,
115                   void (*fun)(ffi_cif*,void*,void**,void*),
116                   void *user_data);
117  
118 -ffi_status
119 +__FFI_DECLSPEC ffi_status
120  ffi_prep_closure_loc (ffi_closure*,
121                       ffi_cif *,
122                       void (*fun)(ffi_cif*,void*,void**,void*),
123 @@ -314,26 +325,26 @@
124  
125  } ffi_java_raw_closure;
126  
127 -ffi_status
128 +__FFI_DECLSPEC ffi_status
129  ffi_prep_raw_closure (ffi_raw_closure*,
130                       ffi_cif *cif,
131                       void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
132                       void *user_data);
133  
134 -ffi_status
135 +__FFI_DECLSPEC ffi_status
136  ffi_prep_raw_closure_loc (ffi_raw_closure*,
137                           ffi_cif *cif,
138                           void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
139                           void *user_data,
140                           void *codeloc);
141  
142 -ffi_status
143 +__FFI_DECLSPEC ffi_status
144  ffi_prep_java_raw_closure (ffi_java_raw_closure*,
145                            ffi_cif *cif,
146                            void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
147                            void *user_data);
148  
149 -ffi_status
150 +__FFI_DECLSPEC ffi_status
151  ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
152                                ffi_cif *cif,
153                                void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
154 @@ -344,16 +355,16 @@
155  
156  /* ---- Public interface definition -------------------------------------- */
157  
158 -ffi_status ffi_prep_cif(ffi_cif *cif,
159 -                       ffi_abi abi,
160 -                       unsigned int nargs,
161 -                       ffi_type *rtype,
162 -                       ffi_type **atypes);
163 -
164 -void ffi_call(ffi_cif *cif,
165 -             void (*fn)(void),
166 -             void *rvalue,
167 -             void **avalue);
168 +__FFI_DECLSPEC ffi_status ffi_prep_cif(ffi_cif *cif,
169 +                                      ffi_abi abi,
170 +                                      unsigned int nargs,
171 +                                      ffi_type *rtype,
172 +                                      ffi_type **atypes);
173 +
174 +__FFI_DECLSPEC void ffi_call(ffi_cif *cif,
175 +                            void (*fn)(void),
176 +                            void *rvalue,
177 +                            void **avalue);
178  
179  /* Useful for eliminating compiler warnings */
180  #define FFI_FN(f) ((void (*)(void))f)
181 diff -Nur libffi-3.0.6/include/ffi_common.h build/include/ffi_common.h
182 --- libffi-3.0.6/include/ffi_common.h   2008-07-12 06:43:00.000000000 +0100
183 +++ build/include/ffi_common.h  2009-01-23 17:56:09.000000000 +0000
184 @@ -49,9 +49,9 @@
185  #endif
186  
187  #ifdef FFI_DEBUG
188 -void ffi_assert(char *expr, char *file, int line);
189 -void ffi_stop_here(void);
190 -void ffi_type_test(ffi_type *a, char *file, int line);
191 +__FFI_DECLSPEC void ffi_assert(char *expr, char *file, int line);
192 +__FFI_DECLSPEC void ffi_stop_here(void);
193 +__FFI_DECLSPEC void ffi_type_test(ffi_type *a, char *file, int line);
194  
195  #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
196  #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
197 @@ -66,7 +66,7 @@
198  #define ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
199  
200  /* Perform machine dependent cif processing */
201 -ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
202 +__FFI_DECLSPEC ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
203  
204  /* Extended cif, used in callback from assembly routine */
205  typedef struct
206 diff -Nur libffi-3.0.6/src/x86/win32.S build/src/x86/win32.S
207 --- libffi-3.0.6/src/x86/win32.S        2008-02-15 01:24:06.000000000 +0000
208 +++ build/src/x86/win32.S       2009-01-23 17:56:09.000000000 +0000
209 @@ -33,8 +33,6 @@
210   
211  .text
212   
213 -.globl ffi_prep_args
214
215          # This assumes we are using gas.
216          .balign 16
217  .globl _ffi_call_SYSV