| ... | ... | @@ -464,6 +464,23 @@ fn posixCallMainAndExit(argc_argv_ptr: [*]usize) callconv(.C) noreturn { |
| 464 | 464 | // Here we look for the stack size in our program headers and use setrlimit |
| 465 | 465 | // to ask for more stack space. |
| 466 | 466 | expandStackSize(phdrs); |
| 467 | |
| 468 | // Disabled with the riscv backend because it cannot handle this code yet. |
| 469 | if (builtin.zig_backend != .stage2_riscv64) { |
| 470 | const opt_init_array_start = @extern([*]*const fn () callconv(.C) void, .{ |
| 471 | .name = "__init_array_start", |
| 472 | .linkage = .weak, |
| 473 | }); |
| 474 | const opt_init_array_end = @extern([*]*const fn () callconv(.C) void, .{ |
| 475 | .name = "__init_array_end", |
| 476 | .linkage = .weak, |
| 477 | }); |
| 478 | if (opt_init_array_start) |init_array_start| { |
| 479 | const init_array_end = opt_init_array_end.?; |
| 480 | const slice = init_array_start[0 .. init_array_end - init_array_start]; |
| 481 | for (slice) |func| func(); |
| 482 | } |
| 483 | } |
| 467 | 484 | } |
| 468 | 485 | |
| 469 | 486 | std.posix.exit(callMainWithArgs(argc, argv, envp)); |