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).
This commit is contained in:
Alex Rønne Petersen 2024-07-25 18:59:16 +02:00
parent d6c637c36b
commit d633b35f35
No known key found for this signature in database

View File

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