Author :
Peter Bergner
Date :
2025-04-08 05:52:37
Hash :3429ed6b Message :powerpc: Add static trampoline support (#894) (#895)
Add static trampoline support to all three powerpc Linux ABIs, specifically
powerpc-linux (32-bit SYSV BE), powerpc64-linux (64-bit ELFv1 BE) and
powerpc64le-linux (64-bit ELFv2 LE). This follows the s390x implementation
and does not introduce a ffi_closure_*_alt function, but rather jumps
directly to the ffi_closure_* function itself. If compiling with
--with-gcc-arch=power10 and pc-relative is enabled, we use a simpler and
smaller trampoline that utilizes Power10's new pc-relative load instructions.
src/powerpc/internal.h
#ifdef FFI_EXEC_STATIC_TRAMP
/* For the trampoline code table mapping, a mapping size of 64K is chosen. */
#define PPC_TRAMP_MAP_SHIFT 16
#define PPC_TRAMP_MAP_SIZE (1 << PPC_TRAMP_MAP_SHIFT)
# ifdef __PCREL__
# define PPC_TRAMP_SIZE 24
# else
# define PPC_TRAMP_SIZE 40
# endif /* __PCREL__ */
#endif /* FFI_EXEC_STATIC_TRAMP */