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]

porting to SVR5


Attached is my attempt at porting libffi-3.0.13 to SVR5 (32bit X86) platforms.
It builds now (and doesn't break other platforms) but I think I need
help with src/x86/sysv.S

All tests fail.
Adding the -v option to runtest I see errors like this.
.......
Testing libffi.call/closure_fn0.c
options: {additional_flags= } {additional_flags=-I/usr/local/src/libs/libffi-3.0.13/testsuite/../include -I/opt/src/libs/libffi-3.0.13/testsuite/../include  -I/usr/local/src/libs/libffi-3.0.13/testsuite/../include/..} additional_flags=-L/usr/local/src/libs/libffi-3.0.13/testsuite/../.libs {libs= -lffi}
doing compile
pid is 28227 -28227
close result is 28227 exp8 0 1
output is Undefined                     first referenced
symbol                              in file
FFI_TYPE_FLOAT                      libffi.so
FFI_TYPE_UINT8                      libffi.so
FFI_TYPE_UINT64                     libffi.so
FFI_TYPE_SINT64                     libffi.so
FFI_TYPE_INT                        libffi.so
FFI_TYPE_DOUBLE                     libffi.so
FFI_TYPE_STRUCT                     libffi.so
FFI_TYPE_LONGDOUBLE                 libffi.so
UX:ld: ERROR: Symbol referencing errors. No output written to ./closure_fn0.exe
 status 1
compiler exited with status 1
FAIL: libffi.call/closure_fn0.c (test for excess errors)
.......

I had to make a bunch of changes to src/x86/sysv.S like this
just to get it to compile.
.....
@@ -302,10 +302,10 @@
 	/* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16,
 	   FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32.  */
 	cmpl	$FFI_TYPE_UINT64, %eax
-	jge	0f
+	jge	.L920
 	cmpl	$FFI_TYPE_UINT8, %eax
 	jge	.Lrcls_retint
-0:
+.L920:
 	cmpl	$FFI_TYPE_FLOAT, %eax
 	je	.Lrcls_retfloat
 	cmpl	$FFI_TYPE_DOUBLE, %eax
.....

The older assemblers do not understand the 0f kind of syntax.

When I saw that support was added of for the Solaris native compilers
I hoped this hunk would do the trick.
@@ -182,7 +182,7 @@
 	leal	-24(%ebp), %edx
 	movl	%edx, -12(%ebp)	/* resp */
 	leal	8(%ebp), %edx
-#ifdef __SUNPRO_C
+#if defined(__SUNPRO_C) || defined(__USLC__)
 	/* The SUNPRO compiler doesn't support GCC's regparm function
   	   attribute, so we have to pass all three arguments to
 	   ffi_closure_SYSV_inner on the stack.  */

But I suspect we need something different because not only is 
the regparm function attribute not supported by the USL (UNIX System Labs)
compiler, but __attribute__ is not suported at all as you can see
from the changes to src/x86/ffi.c.

Any ideas?

Thanks.

-- 
Tim Rice				Multitalents
tim@multitalents.net

Attachment: libffi-3.0.13-SVR5.patch
Description: libffi-3.0.13-SVR5.patch


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