[llvm-commits] Trampoline support (pointers nested funtions)

Duncan Sands baldrick at free.fr
Thu Jul 26 07:56:19 PDT 2007


These patches add support for taking pointers to nested
functions (a gcc extension).  This is done by building
and executing a small code stub on the stack, known as
a trampoline.  The LLVM part adds two new intrinsics,
llvm.init.trampoline and llvm.adjust.trampoline.  The
adjust intrinsic is implemented for all architectures
that are supported in gcc, while the init intrinsic is
only implemented for X86.  Furthermore, trampolines can
interact badly with stack protection mechanisms which
don't much like execution of code on the stack.  GCC
does various tricks to tell the OS that the trampoline
is kosher.  I didn't implement any of those tricks yet,
because it works without them on my machine :)

Enjoy!

Duncan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tramp.diff
Type: text/x-diff
Size: 29376 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070726/0c80a0a0/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tramp-gcc.diff
Type: text/x-diff
Size: 4440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070726/0c80a0a0/attachment-0001.diff>


More information about the llvm-commits mailing list