From 17cb69cebcb05bbc9d9f7cf01c41a97b71f8a499 Mon Sep 17 00:00:00 2001 From: Shawn Landden Date: Sat, 8 Sep 2018 03:14:30 +0000 Subject: fix elf auxv handling Auxillery vectors are not guaranteed to be in any order, this just happens to work on x86_64. --- std/special/bootstrap.zig | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'std/special/bootstrap.zig') 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)); -- cgit v1.2.3