[compiler-rt] [llvm] [AArch64] Implement INIT/ADJUST_TRAMPOLINE (PR #70267)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 15:28:26 PDT 2024


================
@@ -41,3 +41,30 @@ COMPILER_RT_ABI void __trampoline_setup(uint32_t *trampOnStack,
   __clear_cache(trampOnStack, &trampOnStack[10]);
 }
 #endif // __powerpc__ && !defined(__powerpc64__)
+
+// The AArch64 compiler generates calls to __trampoline_setup() when creating
+// trampoline functions on the stack for use with nested functions.
+// This function creates a custom 20-byte trampoline function on the stack
+// which loads x18 with a pointer to the outer function's locals
+// and then jumps to the target nested function.
+
+#if __aarch64__
----------------
MaskRay wrote:

This can be `defined(__aarch64__) && defined(__ELF__)` since other ELF OSes likely need this as well.

https://github.com/llvm/llvm-project/pull/70267


More information about the llvm-commits mailing list