zig/std/bootstrap.zig

13 lines
445 B
Zig
Raw Normal View History

use "std.zig";
2015-12-10 22:34:38 +00:00
2016-01-04 10:31:57 +00:00
// The compiler treats this file special by implicitly importing the function `main`
// from the root source file.
2015-12-10 22:34:38 +00:00
#attribute("naked")
export fn _start() -> unreachable {
const argc = asm("mov (%%rsp), %[argc]" : [argc] "=r" (-> isize));
const argv = asm("lea 0x8(%%rsp), %[argv]" : [argv] "=r" (-> &&u8));
const env = asm("lea 0x10(%%rsp,%%rdi,8), %[env]" : [env] "=r" (-> &&u8));
exit(main(argc, argv, env))
2015-12-10 22:34:38 +00:00
}