aboutsummaryrefslogtreecommitdiff
path: root/std/special/bootstrap.zig
diff options
context:
space:
mode:
authorShawn Landden <shawn@git.icu>2018-09-08 03:14:30 +0000
committerShawn Landden <shawn@git.icu>2018-09-08 14:47:21 +0000
commit17cb69cebcb05bbc9d9f7cf01c41a97b71f8a499 (patch)
tree6ccd66f27a3e52a365aa33bb4c2d5abfc2ab9ce2 /std/special/bootstrap.zig
parent7d6d1d1f607629625413d62c51b0c9f4c81cefe5 (diff)
downloadzig-17cb69cebcb05bbc9d9f7cf01c41a97b71f8a499.tar.gz
zig-17cb69cebcb05bbc9d9f7cf01c41a97b71f8a499.zip
fix elf auxv handling
Auxillery vectors are not guaranteed to be in any order, this just happens to work on x86_64.
Diffstat (limited to 'std/special/bootstrap.zig')
-rw-r--r--std/special/bootstrap.zig7
1 files changed, 2 insertions, 5 deletions
diff --git a/std/special/bootstrap.zig b/std/special/bootstrap.zig
index 6619b2dc2f..feaa04332b 100644
--- a/std/special/bootstrap.zig
+++ b/std/special/bootstrap.zig
@@ -59,11 +59,8 @@ fn posixCallMainAndExit() noreturn {
const envp = @ptrCast([*][*]u8, envp_optional)[0..envp_count];
if (builtin.os == builtin.Os.linux) {
const auxv = @ptrCast([*]usize, envp.ptr + envp_count + 1);
- var i: usize = 0;
- while (auxv[i] != 0) : (i += 2) {
- if (auxv[i] < std.os.linux_aux_raw.len) std.os.linux_aux_raw[auxv[i]] = auxv[i + 1];
- }
- std.debug.assert(std.os.linux_aux_raw[std.elf.AT_PAGESZ] == std.os.page_size);
+ std.os.linux_elf_aux_maybe = @ptrCast([*]std.elf.Auxv, auxv);
+ std.debug.assert(std.os.linuxGetAuxVal(std.elf.AT_PAGESZ) == std.os.page_size);
}
std.os.posix.exit(callMainWithArgs(argc, argv, envp));