| author | |
| committer | |
| log | 0fb005d1d05acb680389ce8be51bab6020309922 |
| tree | bb6bd3fe4ec2cabc09768f3c44205cbcdd8c9725 |
| parent | be579d479753153e78e55b17cb8fd2d55004145b |
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.3 files changed, 16 insertions(+), 8 deletions(-)
lib/std/build.zig+7-2| ... | ... | @@ -3256,11 +3256,16 @@ const ThisModule = @This(); |
| 3256 | 3256 | pub const Step = struct { |
| 3257 | 3257 | id: Id, |
| 3258 | 3258 | name: []const u8, |
| 3259 | makeFn: fn (self: *Step) anyerror!void, | |
| 3259 | makeFn: MakeFn, | |
| 3260 | 3260 | dependencies: ArrayList(*Step), |
| 3261 | 3261 | loop_flag: bool, |
| 3262 | 3262 | done_flag: bool, |
| 3263 | 3263 | |
| 3264 | const MakeFn = switch (builtin.zig_backend) { | |
| 3265 | .stage1 => fn (self: *Step) anyerror!void, | |
| 3266 | else => *const fn (self: *Step) anyerror!void, | |
| 3267 | }; | |
| 3268 | ||
| 3264 | 3269 | pub const Id = enum { |
| 3265 | 3270 | top_level, |
| 3266 | 3271 | lib_exe_obj, |
| ... | ... | @@ -3279,7 +3284,7 @@ pub const Step = struct { |
| 3279 | 3284 | custom, |
| 3280 | 3285 | }; |
| 3281 | 3286 | |
| 3282 | pub fn init(id: Id, name: []const u8, allocator: Allocator, makeFn: fn (*Step) anyerror!void) Step { | |
| 3287 | pub fn init(id: Id, name: []const u8, allocator: Allocator, makeFn: MakeFn) Step { | |
| 3283 | 3288 | return Step{ |
| 3284 | 3289 | .id = id, |
| 3285 | 3290 | .name = allocator.dupe(u8, name) catch unreachable, |
lib/std/start.zig+4-5| ... | ... | @@ -408,11 +408,6 @@ fn posixCallMainAndExit() noreturn { |
| 408 | 408 | // Initialize the TLS area. |
| 409 | 409 | std.os.linux.tls.initStaticTLS(phdrs); |
| 410 | 410 | |
| 411 | if (builtin.zig_backend == .stage2_llvm) { | |
| 412 | root.main(); | |
| 413 | exit2(0); | |
| 414 | } | |
| 415 | ||
| 416 | 411 | // The way Linux executables represent stack size is via the PT_GNU_STACK |
| 417 | 412 | // program header. However the kernel does not recognize it; it always gives 8 MiB. |
| 418 | 413 | // 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 { |
| 454 | 449 | std.os.argv = argv[0..argc]; |
| 455 | 450 | std.os.environ = envp; |
| 456 | 451 | |
| 452 | if (builtin.zig_backend == .stage2_llvm) { | |
| 453 | return @call(.{ .modifier = .always_inline }, callMain, .{}); | |
| 454 | } | |
| 455 | ||
| 457 | 456 | std.debug.maybeEnableSegfaultHandler(); |
| 458 | 457 | |
| 459 | 458 | return initEventLoopAndCallMain(); |
src/Sema.zig+5-1| ... | ... | @@ -12439,7 +12439,11 @@ fn zirErrorReturnTrace( |
| 12439 | 12439 | extended: Zir.Inst.Extended.InstData, |
| 12440 | 12440 | ) CompileError!Air.Inst.Ref { |
| 12441 | 12441 | const src: LazySrcLoc = .{ .node_offset = @bitCast(i32, extended.operand) }; |
| 12442 | return sema.fail(block, src, "TODO: Sema.zirErrorReturnTrace", .{}); | |
| 12442 | const unresolved_stack_trace_ty = try sema.getBuiltinType(block, src, "StackTrace"); | |
| 12443 | const stack_trace_ty = try sema.resolveTypeFields(block, src, unresolved_stack_trace_ty); | |
| 12444 | const opt_stack_trace_ty = try Type.optional(sema.arena, stack_trace_ty); | |
| 12445 | // https://github.com/ziglang/zig/issues/11259 | |
| 12446 | return sema.addConstant(opt_stack_trace_ty, Value.@"null"); | |
| 12443 | 12447 | } |
| 12444 | 12448 | |
| 12445 | 12449 | fn zirFrame( |