callx_stackargs.c (657B)
1 /* A call with MANY (12) int arguments: the AArch64 PCS passes the first 8 in 2 * x0..x7 and the remaining 4 on the stack. Exercises the caller-side stack-arg 3 * stores (str to [sp, #off]) and the callee-side stack-arg loads. `noinline` 4 * forces the real call. Sum 1+2+...+12 = 78, then -36 = 42. */ 5 __attribute__((noinline)) static int add12(int a, int b, int c, int d, int e, 6 int f, int g, int h, int i, int j, 7 int k, int l) { 8 return a + b + c + d + e + f + g + h + i + j + k + l; 9 } 10 int test_main(void) { 11 return add12(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) - 36; 12 }