rtmain.ha (656B)
1 @symbol("main") fn main() void; 2 3 const @symbol("__init_array_start") init_start: [*]*fn() void; 4 const @symbol("__init_array_end") init_end: [*]*fn() void; 5 const @symbol("__fini_array_start") fini_start: [*]*fn() void; 6 const @symbol("__fini_array_end") fini_end: [*]*fn() void; 7 8 export @noreturn fn start_ha(iv: *[*]uintptr) void = { 9 const ninit = (&init_end: uintptr - &init_start: uintptr): size 10 / size(*fn() void); 11 for (let i = 0z; i < ninit; i += 1) { 12 init_start[i](); 13 }; 14 15 main(); 16 17 const nfini = (&fini_end: uintptr - &fini_start: uintptr): size 18 / size(*fn() void); 19 for (let i = 0z; i < nfini; i += 1) { 20 fini_start[i](); 21 }; 22 23 exit(0); 24 };