authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-13 11:51:58-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-15 19:06:39-07:00
log798ad631f3f9836de663bc6c728b415e0a13528f
tree345fe3987200eedf7e00c905dc9e5e98f29ebaa9
parent6dba9bc6fc6741e51af86f71e3057cffed7406a6

stage2 start.zig: slight simplification

fewer required language features to allow this to work

2 files changed, 7 insertions(+), 3 deletions(-)

lib/std/start.zig+3-3
......@@ -11,8 +11,8 @@ const builtin = @import("builtin");
1111const assert = std.debug.assert;
1212const uefi = std.os.uefi;
1313const tlcsprng = @import("crypto/tlcsprng.zig");
14const native_arch = std.Target.current.cpu.arch;
15const native_os = std.Target.current.os.tag;
14const native_arch = builtin.cpu.arch;
15const native_os = builtin.os.tag;
1616
1717var argc_argv_ptr: [*]usize = undefined;
1818
......@@ -80,7 +80,7 @@ fn _start2() callconv(.Naked) noreturn {
8080}
8181
8282fn exit2(code: u8) noreturn {
83 switch (native_arch) {
83 switch (builtin.stage2_arch) {
8484 .x86_64 => {
8585 asm volatile ("syscall"
8686 :
src/Compilation.zig+4
......@@ -3078,7 +3078,10 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) Alloc
30783078 \\/// Zig version. When writing code that supports multiple versions of Zig, prefer
30793079 \\/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.
30803080 \\pub const zig_version = try std.SemanticVersion.parse("{s}");
3081 \\/// Temporary until self-hosted is feature complete.
30813082 \\pub const zig_is_stage2 = {};
3083 \\/// Temporary until self-hosted supports the `cpu.arch` value.
3084 \\pub const stage2_arch: std.Target.Cpu.Arch = .{};
30823085 \\
30833086 \\pub const output_mode = std.builtin.OutputMode.{};
30843087 \\pub const link_mode = std.builtin.LinkMode.{};
......@@ -3093,6 +3096,7 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) Alloc
30933096 , .{
30943097 build_options.version,
30953098 !use_stage1,
3099 std.zig.fmtId(@tagName(target.cpu.arch)),
30963100 std.zig.fmtId(@tagName(comp.bin_file.options.output_mode)),
30973101 std.zig.fmtId(@tagName(comp.bin_file.options.link_mode)),
30983102 comp.bin_file.options.is_test,