mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 21:38:33 +00:00
start.zig: unconditionally import the root source file
stage1 did this by accident by unconditionally semantically analyzing std.builtin.panic, which imports the root source file to look for a panic handler override. But stage2 is smarter; it will only semantically analyze std.builtin.panic if any panic calls are emitted. So for very simple compilations, the root source file was being ignored, even if it contained `export` functions in it.
This commit is contained in:
parent
2d8d681b5e
commit
fb95fd8443
@ -19,6 +19,10 @@ var argc_argv_ptr: [*]usize = undefined;
|
||||
const start_sym_name = if (native_arch.isMIPS()) "__start" else "_start";
|
||||
|
||||
comptime {
|
||||
// No matter what, we import the root file, so that any export, test, comptime
|
||||
// decls there get run.
|
||||
_ = root;
|
||||
|
||||
// The self-hosted compiler is not fully capable of handling all of this start.zig file.
|
||||
// Until then, we have simplified logic here for self-hosted. TODO remove this once
|
||||
// self-hosted is capable enough to handle all of the real start.zig logic.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user