This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ffi API header files with Sun Studio compiler


We use libffi for some software on Solaris. We use sunstudio 12 update 1.
libffi itself has to be built with gcc but sunstudio needs to be able to
make sense of the libffi include files. On sparc, this has worked for
years. I now need to port the software to x86 and have the following
problem when compiling:

pt/pd/libffi-3.0.9/include/ffitarget.h", line 88: Error, undefidenterr:
FFI_DEFAULT_ABI is not defined.
"/opt/pd/libffi-3.0.9/include/ffitarget.h", line 89: Error, notconst: An
integer constant expression is required here.

Looking at the preprocessor outputs, gcc produces:

typedef enum ffi_abi {
  FFI_FIRST_ABI = 0,
  FFI_SYSV,
  FFI_UNIX64,
  FFI_DEFAULT_ABI = FFI_SYSV,
  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
} ffi_abi;

while Sun Studio only gives:

typedef enum ffi_abi {
  FFI_FIRST_ABI = 0,
  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
} ffi_abi;

It'd be good if you could support the predefined preprocessor tokens of
Sun Studio so that this works. I've not tested extensively but with the
attached patch, I can build my software.

Oliver

--- ffitarget.h.orig	Tue Dec 29 16:22:26 2009
+++ ffitarget.h	Fri Jan 15 12:47:13 2010
@@ -74,10 +74,10 @@
 #else
 
   /* ---- Intel x86 and AMD x86-64 - */
-#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__))
+#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__) || defined(__i386) || defined(__amd64))
   FFI_SYSV,
   FFI_UNIX64,   /* Unix variants all use the same ABI for x86-64  */
-#ifdef __i386__
+#if defined(__i386__) || defined(__i386)
   FFI_DEFAULT_ABI = FFI_SYSV,
 #else
   FFI_DEFAULT_ABI = FFI_UNIX64,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]