Commit 0fb005d1d0
lib/std/build.zig
@@ -3256,11 +3256,16 @@ const ThisModule = @This();
pub const Step = struct {
id: Id,
name: []const u8,
- makeFn: fn (self: *Step) anyerror!void,
+ makeFn: MakeFn,
dependencies: ArrayList(*Step),
loop_flag: bool,
done_flag: bool,
+ const MakeFn = switch (builtin.zig_backend) {
+ .stage1 => fn (self: *Step) anyerror!void,
+ else => *const fn (self: *Step) anyerror!void,
+ };
+
pub const Id = enum {
top_level,
lib_exe_obj,
@@ -3279,7 +3284,7 @@ pub const Step = struct {
custom,
};
- pub fn init(id: Id, name: []const u8, allocator: Allocator, makeFn: fn (*Step) anyerror!void) Step {
+ pub fn init(id: Id, name: []const u8, allocator: Allocator, makeFn: MakeFn) Step {
return Step{
.id = id,
.name = allocator.dupe(u8, name) catch unreachable,
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();
src/Sema.zig
@@ -12439,7 +12439,11 @@ fn zirErrorReturnTrace(
extended: Zir.Inst.Extended.InstData,
) CompileError!Air.Inst.Ref {
const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) };
- return sema.fail(block, src, "TODO: Sema.zirErrorReturnTrace", .{});
+ const unresolved_stack_trace_ty = try sema.getBuiltinType(block, src, "StackTrace");
+ const stack_trace_ty = try sema.resolveTypeFields(block, src, unresolved_stack_trace_ty);
+ const opt_stack_trace_ty = try Type.optional(sema.arena, stack_trace_ty);
+ // https://github.com/ziglang/zig/issues/11259
+ return sema.addConstant(opt_stack_trace_ty, Value.@"null");
}
fn zirFrame(