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

Carlos Seo via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 10:59:08 PDT 2024


================
@@ -41,3 +41,45 @@ 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 36-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.
+// Note: x18 is a reserved platform register on Windows and macOS.
+
+#if defined(__aarch64__) && !defined(__APPLE__) && !defined(_WIN64)
----------------
ceseo wrote:

OK, makes sense.

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


More information about the llvm-commits mailing list