aboutsummaryrefslogtreecommitdiff
path: root/lib/std/start.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-03-21 19:07:20 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-21 19:08:30 -0700
commit0fb005d1d05acb680389ce8be51bab6020309922 (patch)
treebb6bd3fe4ec2cabc09768f3c44205cbcdd8c9725 /lib/std/start.zig
parentbe579d479753153e78e55b17cb8fd2d55004145b (diff)
downloadzig-0fb005d1d05acb680389ce8be51bab6020309922.tar.gz
zig-0fb005d1d05acb680389ce8be51bab6020309922.zip
Sema: dummy implementation of `@errorReturnTrace`
Also update std/build.zig to use stage2 function pointer semantics. This gets us a little bit closer to `zig build` working, although it is now hitting a new crash in the compiler.
Diffstat (limited to 'lib/std/start.zig')
-rw-r--r--lib/std/start.zig9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig
index 3502645172..cd247c915e 100644
--- a/lib/std/start.zig
+++ b/lib/std/start.zig
@@ -408,11 +408,6 @@ fn posixCallMainAndExit() noreturn {
// Initialize the TLS area.
std.os.linux.tls.initStaticTLS(phdrs);
- if (builtin.zig_backend == .stage2_llvm) {
- root.main();
- exit2(0);
- }
-
// The way Linux executables represent stack size is via the PT_GNU_STACK
// program header. However the kernel does not recognize it; it always gives 8 MiB.
// Here we look for the stack size in our program headers and use setrlimit
@@ -454,6 +449,10 @@ fn callMainWithArgs(argc: usize, argv: [*][*:0]u8, envp: [][*:0]u8) u8 {
std.os.argv = argv[0..argc];
std.os.environ = envp;
+ if (builtin.zig_backend == .stage2_llvm) {
+ return @call(.{ .modifier = .always_inline }, callMain, .{});
+ }
+
std.debug.maybeEnableSegfaultHandler();
return initEventLoopAndCallMain();