zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d633b35f35ddb9dd4db8529346bbb414cf8fbfbd (tree)
parent d6c637c36b399ae9d876592826f3e62d7636dc8e
Author: Alex Rønne Petersen <alex@alexrp.com>
Date:   Thu, 25 Jul 2024 18:59:16 +0200

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).

Diffstat:
Mlib/std/start.zig | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/std/start.zig b/lib/std/start.zig @@ -472,10 +472,11 @@ fn posixCallMainAndExit(argc_argv_ptr: [*]usize) callconv(.C) noreturn { break :init @as([*]elf.Phdr, @ptrFromInt(at_phdr))[0..at_phnum]; }; - // Apply the initial relocations as early as possible in the startup - // process. + // Apply the initial relocations as early as possible in the startup process. We cannot + // 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) { - 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