callx_recursion.c (396B)
1 /* A small recursive sum: sum(n) = n + sum(n-1), sum(0) = 0. `noinline` keeps 2 * the recursive self-call a real CALL26 (`bl sum`) plus the base-case branch. 3 * Exercises a self-referential same-section call relocation. sum(8) = 36, then 4 * +6 = 42. */ 5 __attribute__((noinline)) static int sum(int n) { 6 if (n <= 0) return 0; 7 return n + sum(n - 1); 8 } 9 int test_main(void) { return sum(8) + 6; }