This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: vararg calls with libffi on x86_64
- From: Andreas Degert <ad at papyrus-gmbh dot de>
- To: tromey at redhat dot com
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 04 May 2005 19:01:40 +0200
- Subject: Re: vararg calls with libffi on x86_64
- References: <E1DRZei-0000Tc-00@pluto.noname><m3ekcnvv4w.fsf@localhost.localdomain>
Tom Tromey <tromey@redhat.com> writes:
>>>>>> "Andreas" == Andreas Degert <ad@papyrus-gmbh.de> writes:
>
> Andreas> In the libffi README is a note that vararg functions are not supported
> Andreas> yet. Anyhow, they work on x86 nevertheless, and the appended patch
> Andreas> makes them work on x86_64 too.
>
> If we're going to support varargs on some platforms, it would be
> great to have the README updated to explain how this is to be used.
> That way other ports could converge on the same model, the user can
> know what to expect, etc. Also, it might be nice to have a
> per-config #define so that users of libffi can tell whether the
> particular support supports varargs.
At the moment, there is no provision on the API level for vararg
calls. For the caller on x86 there is no difference to fixed arg
calls, and on x86_64 the additional information needed is cheap and
can be supplied with both sorts of calls.
A #define would be helpful, and one could also supply test cases for
the testsuit then.
For the general API, I think it would be necessary to mark a vararg
call when calling ffi_prep_cif(). Maybe adding a flag which can be
used with the abi parameter, so one could use
FFI_DEFAULT_ABI|FFI_VARARG ? This would just return an error with
current versions with libffi (ABI not supported).
ciao
Andreas