[Openmcl-devel] Re: ffigen for GCC 3.4

David Steuber david at david-steuber.com
Tue Feb 1 12:47:43 PST 2005


Sorry for this reply to an old mail, but I started looking at FFIGEN 
today.  When I ran into trouble, I googled and found this.

> On Sun, 15 Aug 2004, Cyrus Harmon wrote:
>
>> openmcl-dev,
>>
>> I have tried to use the ffigen with some success, but I needed to do
>> the following:
>>
>> *** ffi.c       Sun Aug 15 14:07:57 2004
>> --- ../../ffigen-3.4.1/ffi.c    Tue Aug  3 07:48:48 2004
>> ***************
>> *** 162,168 ****
>>      for (; map->gcc_name; ++map)
>>        if (!strcmp (map->gcc_name, gcc_name))
>>          return (char*)map->ffi_name;
>> -   return 0;
>>      fprintf (stderr, "Bug: couldn't find primitive name for %s\n",
>> gcc_name);
>>      abort ();
>>    }
>> --- 162,167 ----
>> ***************
>>
>> to get it to work right. Otherwise, it complains about not being able
>> to find the primitive for __int128_t (I think that's right). One
>> difference is that I'm using the gcc-3.4.1 tarball not gcc-3.4.1-core.
>> I had to disable gcj and this could be the source of the 128-bit
>> weirdness. In any event, I thought you'd like to know. I'll keep
>> plowing ahead and see if I can make this work all the way through for
>> the stuff I'm working on.

I had precisely the same problem using the gcc-3.4.1-core tarball.  I 
chose a different fix.  See below.

On Aug 16, 2004, at 4:56 AM, Gary Byers wrote:

> If I understand correctly, I think that we want to add an entry for
> "__int128_t" to FFIGEN's primitive type table.  (Since lisp won't
> understand how to pass/return 128-bit integers around for a while,
> it may not matter too much whether it fails because of an unknown
> foreign type or a known but unsupported foreign type, but making
> the type "known" on both sides of the translation process will
> eventually allow it to be supported.)

I don't know what names Gary prefers, but I thought I would follow this 
advice.  I also uncovered another primitive type that needed a mapping. 
  Here is my test run (on OS X 10.3.7 with Xcode 1.5 installed) that 
shows it worked for me followed by my diff:

$ ./cc1 -fsyntax-only -g3 -I include/ /usr/include/stdio.h -o 
/Users/david/stdio.ffi
  __sputc

Execution times (seconds)
  preprocessing         :   0.01 (20%) usr   0.01 (33%) sys   0.01 ( 5%) 
wall
  lexical analysis      :   0.01 (20%) usr   0.01 (33%) sys   0.00 ( 0%) 
wall
  parser                :   0.01 (20%) usr   0.00 ( 0%) sys   0.17 (81%) 
wall
  TOTAL                 :   0.05             0.03             0.21

$ diff -u ffigen-3.4.1/ffi.c gcc-3.4.1/gcc/ffi.c
--- ffigen-3.4.1/ffi.c  Tue Aug  3 10:48:48 2004
+++ gcc-3.4.1/gcc/ffi.c Tue Feb  1 15:26:40 2005
@@ -151,6 +151,8 @@
    {"complex long double", "complex-long-double"},
    {"__builtin_va_list", "builtin-va-list"},
    {"_Bool", "bool"},
+  {"__int128_t", "int128"},
+  {"__uint128_t", "uint128"},
    {NULL, NULL}
  };




More information about the Openmcl-devel mailing list