This is the mail archive of the
mailing list for the GCC project.
Re: Is this a bug in libffi testsuite on solaris2.8?
Andrew Haley <email@example.com> writes:
> > Looking at libffi/src/sparc/ffi.c (ffi_prep_closure, in particular)
> > leads me to believe that libffi intentionally places code on the stack
> > and executes it. This is unfortunate but may be unavoidable.
> Not necessarily: the memory for the trampoline is allocated by the
> caller, and can be anywhere. However, unwindtest.c does indeed
> allocate it on the stack.
Ah, ok. It might be a good idea to change that to malloc() space
... that won't help on even more paranoid systems (recent openbsd
comes to mind) but it will solve Brad's problem.
As an aside, I've occasionally thought that it would be nice for
the C compiler to have the ability to synthesize calls to malloc
and free for large alloca requests. If we had this, we could
also use it for nested function trampolines, adding more overhead
but avoiding this sort of issue.