aboutsummaryrefslogtreecommitdiff
path: root/lib/std/start.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-07-25 18:59:16 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2024-07-29 10:08:34 +0200
commitd633b35f35ddb9dd4db8529346bbb414cf8fbfbd (patch)
treed5bd84eafbeda3e177cd0b8b0925cedc421ee18a /lib/std/start.zig
parentd6c637c36b399ae9d876592826f3e62d7636dc8e (diff)
downloadzig-d633b35f35ddb9dd4db8529346bbb414cf8fbfbd.tar.gz
zig-d633b35f35ddb9dd4db8529346bbb414cf8fbfbd.zip
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 (limited to 'lib/std/start.zig')
-rw-r--r--lib/std/start.zig7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig
index 5bbb4dadce..d40765e4cb 100644
--- 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