aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-07-24 17:38:54 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2024-07-24 20:12:14 +0200
commit5c96192c196c3a43f43de26c8256ed9a784f5140 (patch)
treea0a7ba035a22f8e0596360551c2771b8b201746c /lib/std
parent4de8bba648c6ab9e2f3a05f3f90ba6524520d3c0 (diff)
downloadzig-5c96192c196c3a43f43de26c8256ed9a784f5140.tar.gz
zig-5c96192c196c3a43f43de26c8256ed9a784f5140.zip
start: Add a comment explaining our paranoid stance on ABI guarantees.
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/start.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig
index 9d4edd16bf..21baacc764 100644
--- a/lib/std/start.zig
+++ b/lib/std/start.zig
@@ -272,6 +272,12 @@ fn _start() callconv(.Naked) noreturn {
: [tos] "={rax}" (-> *std.os.plan9.Tos),
);
}
+
+ // Note that we maintain a very low level of trust with regards to ABI guarantees at this point.
+ // We will redundantly align the stack, clear the link register, etc. While e.g. the Linux
+ // kernel is usually good about upholding the ABI guarantees, the same cannot be said of dynamic
+ // linkers; musl's ldso, for example, opts to not align the stack when invoking the dynamic
+ // linker explicitly.
asm volatile (switch (native_arch) {
.x86_64 =>
\\ xorl %%ebp, %%ebp