a.c (1855B)
1 /* Mach-O atom stress: many subsections-via-symbols functions in one input 2 * section, with data relocations keeping the live atoms reachable. */ 3 4 #define NOINLINE __attribute__((noinline)) 5 6 // clang-format off 7 #define EACH64(M) \ 8 M(0) \ 9 M(1) \ 10 M(2) \ 11 M(3) \ 12 M(4) \ 13 M(5) \ 14 M(6) \ 15 M(7) \ 16 M(8) \ 17 M(9) \ 18 M(10) \ 19 M(11) \ 20 M(12) \ 21 M(13) \ 22 M(14) \ 23 M(15) \ 24 M(16) \ 25 M(17) \ 26 M(18) \ 27 M(19) \ 28 M(20) \ 29 M(21) \ 30 M(22) \ 31 M(23) \ 32 M(24) \ 33 M(25) \ 34 M(26) \ 35 M(27) \ 36 M(28) \ 37 M(29) \ 38 M(30) \ 39 M(31) \ 40 M(32) \ 41 M(33) \ 42 M(34) \ 43 M(35) \ 44 M(36) \ 45 M(37) \ 46 M(38) \ 47 M(39) \ 48 M(40) \ 49 M(41) \ 50 M(42) \ 51 M(43) \ 52 M(44) \ 53 M(45) \ 54 M(46) \ 55 M(47) \ 56 M(48) \ 57 M(49) \ 58 M(50) \ 59 M(51) \ 60 M(52) \ 61 M(53) \ 62 M(54) \ 63 M(55) \ 64 M(56) \ 65 M(57) \ 66 M(58) \ 67 M(59) \ 68 M(60) \ 69 M(61) \ 70 M(62) \ 71 M(63) 72 // clang-format on 73 74 #define LIVE_DEF(n) \ 75 NOINLINE int live_##n(void) { return n; } 76 #define DEAD_DEF(n) \ 77 NOINLINE int dead_##n(void) { return n; } 78 #define LIVE_REF(n) live_##n, 79 80 EACH64(LIVE_DEF) 81 EACH64(DEAD_DEF) 82 83 typedef int (*Fn)(void); 84 85 Fn live_table[] = {EACH64(LIVE_REF)}; 86 87 int test_main(void) { 88 volatile Fn* p = live_table; 89 return p[63](); 90 }