This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: vararg calls with libffi on x86_64


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


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