authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-25 18:59:16+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-29 10:08:34+02:00
logd633b35f35ddb9dd4db8529346bbb414cf8fbfbd
treed5bd84eafbeda3e177cd0b8b0925cedc421ee18a
parentd6c637c36b399ae9d876592826f3e62d7636dc8e
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

start: Always inline the call to std.os.linux.pie.relocate().

At this stage, we're not ready to make calls yet on some architectures (e.g. MIPS).

1 files changed, 4 insertions(+), 3 deletions(-)

lib/std/start.zig+4-3
......@@ -472,10 +472,11 @@ fn posixCallMainAndExit(argc_argv_ptr: [*]usize) callconv(.C) noreturn {
472472 break :init @as([*]elf.Phdr, @ptrFromInt(at_phdr))[0..at_phnum];
473473 };
474474
475 // Apply the initial relocations as early as possible in the startup
476 // process.
475 // Apply the initial relocations as early as possible in the startup process. We cannot
476 // make calls yet on some architectures (e.g. MIPS) *because* they haven't been applied yet,
477 // so this must be fully inlined.
477478 if (builtin.position_independent_executable) {
478 std.os.linux.pie.relocate(phdrs);
479 @call(.always_inline, std.os.linux.pie.relocate, .{phdrs});
479480 }
480481
481482 // This must be done after PIE relocations have been applied or we may crash