authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-11-29 15:57:34+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-11-29 21:44:08+02:00
loge60db701d13a50798222bbef2d4560245f975671
treefb3f0e65bb9fb8937771b230775c669e70efaaac
parented734299269d50083db27d68598ced7df42b8631

Sema: add option to disable formatted panics

Closes #13174

4 files changed, 64 insertions(+), 29 deletions(-)

lib/std/builtin.zig+4
...@@ -891,6 +891,10 @@ pub const panic_messages = struct {...@@ -891,6 +891,10 @@ pub const panic_messages = struct {
891 pub const corrupt_switch = "switch on corrupt value";891 pub const corrupt_switch = "switch on corrupt value";
892 pub const shift_rhs_too_big = "shift amount is greater than the type size";892 pub const shift_rhs_too_big = "shift amount is greater than the type size";
893 pub const invalid_enum_value = "invalid enum value";893 pub const invalid_enum_value = "invalid enum value";
894 pub const sentinel_mismatch = "sentinel mismatch";
895 pub const unwrap_error = "attempt to unwrap error";
896 pub const index_out_of_bounds = "index out of bounds";
897 pub const start_index_greater_than_end = "start index is larger than end index";
894};898};
895899
896pub noinline fn returnError(st: *StackTrace) void {900pub noinline fn returnError(st: *StackTrace) void {
src/Compilation.zig+5
...@@ -101,6 +101,7 @@ debug_compile_errors: bool,...@@ -101,6 +101,7 @@ debug_compile_errors: bool,
101job_queued_compiler_rt_lib: bool = false,101job_queued_compiler_rt_lib: bool = false,
102job_queued_compiler_rt_obj: bool = false,102job_queued_compiler_rt_obj: bool = false,
103alloc_failure_occurred: bool = false,103alloc_failure_occurred: bool = false,
104formatted_panics: bool = false,
104105
105c_source_files: []const CSourceFile,106c_source_files: []const CSourceFile,
106clang_argv: []const []const u8,107clang_argv: []const []const u8,
...@@ -937,6 +938,7 @@ pub const InitOptions = struct {...@@ -937,6 +938,7 @@ pub const InitOptions = struct {
937 use_stage1: ?bool = null,938 use_stage1: ?bool = null,
938 single_threaded: ?bool = null,939 single_threaded: ?bool = null,
939 strip: ?bool = null,940 strip: ?bool = null,
941 formatted_panics: ?bool = null,
940 rdynamic: bool = false,942 rdynamic: bool = false,
941 function_sections: bool = false,943 function_sections: bool = false,
942 no_builtin: bool = false,944 no_builtin: bool = false,
...@@ -1457,6 +1459,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {...@@ -1457,6 +1459,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
1457 .Debug => @as(u8, 0),1459 .Debug => @as(u8, 0),
1458 else => @as(u8, 3),1460 else => @as(u8, 3),
1459 };1461 };
1462 const formatted_panics = options.formatted_panics orelse (options.optimize_mode == .Debug);
14601463
1461 // We put everything into the cache hash that *cannot be modified1464 // We put everything into the cache hash that *cannot be modified
1462 // during an incremental update*. For example, one cannot change the1465 // during an incremental update*. For example, one cannot change the
...@@ -1551,6 +1554,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {...@@ -1551,6 +1554,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
1551 hash.addOptionalBytes(options.test_name_prefix);1554 hash.addOptionalBytes(options.test_name_prefix);
1552 hash.add(options.skip_linker_dependencies);1555 hash.add(options.skip_linker_dependencies);
1553 hash.add(options.parent_compilation_link_libc);1556 hash.add(options.parent_compilation_link_libc);
1557 hash.add(formatted_panics);
15541558
1555 // In the case of incremental cache mode, this `zig_cache_artifact_directory`1559 // In the case of incremental cache mode, this `zig_cache_artifact_directory`
1556 // is computed based on a hash of non-linker inputs, and it is where all1560 // is computed based on a hash of non-linker inputs, and it is where all
...@@ -1957,6 +1961,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {...@@ -1957,6 +1961,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
1957 .owned_link_dir = owned_link_dir,1961 .owned_link_dir = owned_link_dir,
1958 .color = options.color,1962 .color = options.color,
1959 .reference_trace = options.reference_trace,1963 .reference_trace = options.reference_trace,
1964 .formatted_panics = formatted_panics,
1960 .time_report = options.time_report,1965 .time_report = options.time_report,
1961 .stack_report = options.stack_report,1966 .stack_report = options.stack_report,
1962 .unwind_tables = unwind_tables,1967 .unwind_tables = unwind_tables,
src/Sema.zig+47-29
...@@ -667,9 +667,9 @@ pub const Block = struct {...@@ -667,9 +667,9 @@ pub const Block = struct {
667 return result_index;667 return result_index;
668 }668 }
669669
670 fn addUnreachable(block: *Block, src: LazySrcLoc, safety_check: bool) !void {670 fn addUnreachable(block: *Block, safety_check: bool) !void {
671 if (safety_check and block.wantSafety()) {671 if (safety_check and block.wantSafety()) {
672 _ = try block.sema.safetyPanic(block, src, .unreach);672 try block.sema.safetyPanic(block, .unreach);
673 } else {673 } else {
674 _ = try block.addNoOp(.unreach);674 _ = try block.addNoOp(.unreach);
675 }675 }
...@@ -5003,7 +5003,8 @@ fn zirPanic(sema: *Sema, block: *Block, inst: Zir.Inst.Index, force_comptime: bo...@@ -5003,7 +5003,8 @@ fn zirPanic(sema: *Sema, block: *Block, inst: Zir.Inst.Index, force_comptime: bo
5003 if (block.is_comptime or force_comptime) {5003 if (block.is_comptime or force_comptime) {
5004 return sema.fail(block, src, "encountered @panic at comptime", .{});5004 return sema.fail(block, src, "encountered @panic at comptime", .{});
5005 }5005 }
5006 return sema.panicWithMsg(block, src, msg_inst);5006 try sema.panicWithMsg(block, src, msg_inst);
5007 return always_noreturn;
5007}5008}
50085009
5009fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {5010fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
...@@ -7962,7 +7963,7 @@ fn analyzeErrUnionPayload(...@@ -7962,7 +7963,7 @@ fn analyzeErrUnionPayload(
7962 if (safety_check and block.wantSafety() and7963 if (safety_check and block.wantSafety() and
7963 !err_union_ty.errorUnionSet().errorSetIsEmpty())7964 !err_union_ty.errorUnionSet().errorSetIsEmpty())
7964 {7965 {
7965 try sema.panicUnwrapError(block, src, operand, .unwrap_errunion_err, .is_non_err);7966 try sema.panicUnwrapError(block, operand, .unwrap_errunion_err, .is_non_err);
7966 }7967 }
79677968
7968 return block.addTyOp(.unwrap_errunion_payload, payload_ty, operand);7969 return block.addTyOp(.unwrap_errunion_payload, payload_ty, operand);
...@@ -8047,7 +8048,7 @@ fn analyzeErrUnionPayloadPtr(...@@ -8047,7 +8048,7 @@ fn analyzeErrUnionPayloadPtr(
8047 if (safety_check and block.wantSafety() and8048 if (safety_check and block.wantSafety() and
8048 !err_union_ty.errorUnionSet().errorSetIsEmpty())8049 !err_union_ty.errorUnionSet().errorSetIsEmpty())
8049 {8050 {
8050 try sema.panicUnwrapError(block, src, operand, .unwrap_errunion_err_ptr, .is_non_err_ptr);8051 try sema.panicUnwrapError(block, operand, .unwrap_errunion_err_ptr, .is_non_err_ptr);
8051 }8052 }
80528053
8053 const air_tag: Air.Inst.Tag = if (initializing)8054 const air_tag: Air.Inst.Tag = if (initializing)
...@@ -9542,7 +9543,7 @@ fn zirSwitchCapture(...@@ -9542,7 +9543,7 @@ fn zirSwitchCapture(
9542 .ErrorSet => if (block.switch_else_err_ty) |some| {9543 .ErrorSet => if (block.switch_else_err_ty) |some| {
9543 return sema.bitCast(block, some, operand, operand_src);9544 return sema.bitCast(block, some, operand, operand_src);
9544 } else {9545 } else {
9545 try block.addUnreachable(operand_src, false);9546 try block.addUnreachable(false);
9546 return Air.Inst.Ref.unreachable_value;9547 return Air.Inst.Ref.unreachable_value;
9547 },9548 },
9548 else => return operand,9549 else => return operand,
...@@ -10975,7 +10976,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError...@@ -10975,7 +10976,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
10975 // that it is unreachable.10976 // that it is unreachable.
10976 if (case_block.wantSafety()) {10977 if (case_block.wantSafety()) {
10977 try sema.zirDbgStmt(&case_block, cond_dbg_node_index);10978 try sema.zirDbgStmt(&case_block, cond_dbg_node_index);
10978 _ = try sema.safetyPanic(&case_block, src, .corrupt_switch);10979 try sema.safetyPanic(&case_block, .corrupt_switch);
10979 } else {10980 } else {
10980 _ = try case_block.addNoOp(.unreach);10981 _ = try case_block.addNoOp(.unreach);
10981 }10982 }
...@@ -11304,6 +11305,11 @@ fn maybeErrorUnwrap(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, op...@@ -11304,6 +11305,11 @@ fn maybeErrorUnwrap(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, op
11304 const inst_data = sema.code.instructions.items(.data)[inst].@"unreachable";11305 const inst_data = sema.code.instructions.items(.data)[inst].@"unreachable";
11305 const src = inst_data.src();11306 const src = inst_data.src();
1130611307
11308 if (!sema.mod.comp.formatted_panics) {
11309 try sema.safetyPanic(block, .unwrap_error);
11310 return true;
11311 }
11312
11307 const panic_fn = try sema.getBuiltin("panicUnwrapError");11313 const panic_fn = try sema.getBuiltin("panicUnwrapError");
11308 const err_return_trace = try sema.getErrorReturnTrace(block);11314 const err_return_trace = try sema.getErrorReturnTrace(block);
11309 const args: [2]Air.Inst.Ref = .{ err_return_trace, operand };11315 const args: [2]Air.Inst.Ref = .{ err_return_trace, operand };
...@@ -16513,7 +16519,7 @@ fn zirUnreachable(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError...@@ -16513,7 +16519,7 @@ fn zirUnreachable(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
16513 return sema.fail(block, src, "reached unreachable code", .{});16519 return sema.fail(block, src, "reached unreachable code", .{});
16514 }16520 }
16515 // TODO Add compile error for @optimizeFor occurring too late in a scope.16521 // TODO Add compile error for @optimizeFor occurring too late in a scope.
16516 try block.addUnreachable(src, true);16522 try block.addUnreachable(true);
16517 return always_noreturn;16523 return always_noreturn;
16518}16524}
1651916525
...@@ -22128,6 +22134,10 @@ pub const PanicId = enum {...@@ -22128,6 +22134,10 @@ pub const PanicId = enum {
22128 corrupt_switch,22134 corrupt_switch,
22129 shift_rhs_too_big,22135 shift_rhs_too_big,
22130 invalid_enum_value,22136 invalid_enum_value,
22137 sentinel_mismatch,
22138 unwrap_error,
22139 index_out_of_bounds,
22140 start_index_greater_than_end,
22131};22141};
2213222142
22133fn addSafetyCheck(22143fn addSafetyCheck(
...@@ -22152,12 +22162,7 @@ fn addSafetyCheck(...@@ -22152,12 +22162,7 @@ fn addSafetyCheck(
2215222162
22153 defer fail_block.instructions.deinit(gpa);22163 defer fail_block.instructions.deinit(gpa);
2215422164
22155 // This function doesn't actually need a src location but if22165 try sema.safetyPanic(&fail_block, panic_id);
22156 // the panic function interface ever changes passing `.unneeded` here
22157 // will cause confusing panics.
22158 const src = sema.src;
22159 _ = try sema.safetyPanic(&fail_block, src, panic_id);
22160
22161 try sema.addSafetyCheckExtra(parent_block, ok, &fail_block);22166 try sema.addSafetyCheckExtra(parent_block, ok, &fail_block);
22162}22167}
2216322168
...@@ -22221,7 +22226,7 @@ fn panicWithMsg(...@@ -22221,7 +22226,7 @@ fn panicWithMsg(
22221 block: *Block,22226 block: *Block,
22222 src: LazySrcLoc,22227 src: LazySrcLoc,
22223 msg_inst: Air.Inst.Ref,22228 msg_inst: Air.Inst.Ref,
22224) !Zir.Inst.Index {22229) !void {
22225 const mod = sema.mod;22230 const mod = sema.mod;
22226 const arena = sema.arena;22231 const arena = sema.arena;
2222722232
...@@ -22232,7 +22237,7 @@ fn panicWithMsg(...@@ -22232,7 +22237,7 @@ fn panicWithMsg(
22232 // TODO implement this feature in all the backends and then delete this branch22237 // TODO implement this feature in all the backends and then delete this branch
22233 _ = try block.addNoOp(.breakpoint);22238 _ = try block.addNoOp(.breakpoint);
22234 _ = try block.addNoOp(.unreach);22239 _ = try block.addNoOp(.unreach);
22235 return always_noreturn;22240 return;
22236 }22241 }
22237 const panic_fn = try sema.getBuiltin("panic");22242 const panic_fn = try sema.getBuiltin("panic");
22238 const unresolved_stack_trace_ty = try sema.getBuiltinType("StackTrace");22243 const unresolved_stack_trace_ty = try sema.getBuiltinType("StackTrace");
...@@ -22248,19 +22253,20 @@ fn panicWithMsg(...@@ -22248,19 +22253,20 @@ fn panicWithMsg(
22248 );22253 );
22249 const args: [3]Air.Inst.Ref = .{ msg_inst, null_stack_trace, .null_value };22254 const args: [3]Air.Inst.Ref = .{ msg_inst, null_stack_trace, .null_value };
22250 _ = try sema.analyzeCall(block, panic_fn, src, src, .auto, false, &args, null);22255 _ = try sema.analyzeCall(block, panic_fn, src, src, .auto, false, &args, null);
22251 return always_noreturn;
22252}22256}
2225322257
22254fn panicUnwrapError(22258fn panicUnwrapError(
22255 sema: *Sema,22259 sema: *Sema,
22256 parent_block: *Block,22260 parent_block: *Block,
22257 src: LazySrcLoc,
22258 operand: Air.Inst.Ref,22261 operand: Air.Inst.Ref,
22259 unwrap_err_tag: Air.Inst.Tag,22262 unwrap_err_tag: Air.Inst.Tag,
22260 is_non_err_tag: Air.Inst.Tag,22263 is_non_err_tag: Air.Inst.Tag,
22261) !void {22264) !void {
22262 assert(!parent_block.is_comptime);22265 assert(!parent_block.is_comptime);
22263 const ok = try parent_block.addUnOp(is_non_err_tag, operand);22266 const ok = try parent_block.addUnOp(is_non_err_tag, operand);
22267 if (!sema.mod.comp.formatted_panics) {
22268 return sema.addSafetyCheck(parent_block, ok, .unwrap_error);
22269 }
22264 const gpa = sema.gpa;22270 const gpa = sema.gpa;
2226522271
22266 var fail_block: Block = .{22272 var fail_block: Block = .{
...@@ -22289,7 +22295,7 @@ fn panicUnwrapError(...@@ -22289,7 +22295,7 @@ fn panicUnwrapError(
22289 const err = try fail_block.addTyOp(unwrap_err_tag, Type.anyerror, operand);22295 const err = try fail_block.addTyOp(unwrap_err_tag, Type.anyerror, operand);
22290 const err_return_trace = try sema.getErrorReturnTrace(&fail_block);22296 const err_return_trace = try sema.getErrorReturnTrace(&fail_block);
22291 const args: [2]Air.Inst.Ref = .{ err_return_trace, err };22297 const args: [2]Air.Inst.Ref = .{ err_return_trace, err };
22292 _ = try sema.analyzeCall(&fail_block, panic_fn, src, src, .auto, false, &args, null);22298 _ = try sema.analyzeCall(&fail_block, panic_fn, sema.src, sema.src, .auto, false, &args, null);
22293 }22299 }
22294 }22300 }
22295 try sema.addSafetyCheckExtra(parent_block, ok, &fail_block);22301 try sema.addSafetyCheckExtra(parent_block, ok, &fail_block);
...@@ -22304,7 +22310,10 @@ fn panicIndexOutOfBounds(...@@ -22304,7 +22310,10 @@ fn panicIndexOutOfBounds(
22304) !void {22310) !void {
22305 assert(!parent_block.is_comptime);22311 assert(!parent_block.is_comptime);
22306 const ok = try parent_block.addBinOp(cmp_op, index, len);22312 const ok = try parent_block.addBinOp(cmp_op, index, len);
22307 try sema.safetyPanicFormatted(parent_block, ok, "panicOutOfBounds", &.{ index, len });22313 if (!sema.mod.comp.formatted_panics) {
22314 return sema.addSafetyCheck(parent_block, ok, .index_out_of_bounds);
22315 }
22316 try sema.safetyCheckFormatted(parent_block, ok, "panicOutOfBounds", &.{ index, len });
22308}22317}
2230922318
22310fn panicStartLargerThanEnd(22319fn panicStartLargerThanEnd(
...@@ -22315,7 +22324,10 @@ fn panicStartLargerThanEnd(...@@ -22315,7 +22324,10 @@ fn panicStartLargerThanEnd(
22315) !void {22324) !void {
22316 assert(!parent_block.is_comptime);22325 assert(!parent_block.is_comptime);
22317 const ok = try parent_block.addBinOp(.cmp_lte, start, end);22326 const ok = try parent_block.addBinOp(.cmp_lte, start, end);
22318 try sema.safetyPanicFormatted(parent_block, ok, "panicStartGreaterThanEnd", &.{ start, end });22327 if (!sema.mod.comp.formatted_panics) {
22328 return sema.addSafetyCheck(parent_block, ok, .start_index_greater_than_end);
22329 }
22330 try sema.safetyCheckFormatted(parent_block, ok, "panicStartGreaterThanEnd", &.{ start, end });
22319}22331}
2232022332
22321fn panicInactiveUnionField(22333fn panicInactiveUnionField(
...@@ -22326,7 +22338,10 @@ fn panicInactiveUnionField(...@@ -22326,7 +22338,10 @@ fn panicInactiveUnionField(
22326) !void {22338) !void {
22327 assert(!parent_block.is_comptime);22339 assert(!parent_block.is_comptime);
22328 const ok = try parent_block.addBinOp(.cmp_eq, active_tag, wanted_tag);22340 const ok = try parent_block.addBinOp(.cmp_eq, active_tag, wanted_tag);
22329 try sema.safetyPanicFormatted(parent_block, ok, "panicInactiveUnionField", &.{ active_tag, wanted_tag });22341 if (!sema.mod.comp.formatted_panics) {
22342 return sema.addSafetyCheck(parent_block, ok, .inactive_union_field);
22343 }
22344 try sema.safetyCheckFormatted(parent_block, ok, "panicInactiveUnionField", &.{ active_tag, wanted_tag });
22330}22345}
2233122346
22332fn panicSentinelMismatch(22347fn panicSentinelMismatch(
...@@ -22369,16 +22384,20 @@ fn panicSentinelMismatch(...@@ -22369,16 +22384,20 @@ fn panicSentinelMismatch(
22369 return;22384 return;
22370 };22385 };
2237122386
22372 try sema.safetyPanicFormatted(parent_block, ok, "panicSentinelMismatch", &.{ expected_sentinel, actual_sentinel });22387 if (!sema.mod.comp.formatted_panics) {
22388 return sema.addSafetyCheck(parent_block, ok, .sentinel_mismatch);
22389 }
22390 try sema.safetyCheckFormatted(parent_block, ok, "panicSentinelMismatch", &.{ expected_sentinel, actual_sentinel });
22373}22391}
2237422392
22375fn safetyPanicFormatted(22393fn safetyCheckFormatted(
22376 sema: *Sema,22394 sema: *Sema,
22377 parent_block: *Block,22395 parent_block: *Block,
22378 ok: Air.Inst.Ref,22396 ok: Air.Inst.Ref,
22379 func: []const u8,22397 func: []const u8,
22380 args: []const Air.Inst.Ref,22398 args: []const Air.Inst.Ref,
22381) CompileError!void {22399) CompileError!void {
22400 assert(sema.mod.comp.formatted_panics);
22382 const gpa = sema.gpa;22401 const gpa = sema.gpa;
2238322402
22384 var fail_block: Block = .{22403 var fail_block: Block = .{
...@@ -22413,19 +22432,18 @@ fn safetyPanicFormatted(...@@ -22413,19 +22432,18 @@ fn safetyPanicFormatted(
22413fn safetyPanic(22432fn safetyPanic(
22414 sema: *Sema,22433 sema: *Sema,
22415 block: *Block,22434 block: *Block,
22416 src: LazySrcLoc,
22417 panic_id: PanicId,22435 panic_id: PanicId,
22418) CompileError!Zir.Inst.Index {22436) CompileError!void {
22419 const panic_messages_ty = try sema.getBuiltinType("panic_messages");22437 const panic_messages_ty = try sema.getBuiltinType("panic_messages");
22420 const msg_decl_index = (try sema.namespaceLookup(22438 const msg_decl_index = (try sema.namespaceLookup(
22421 block,22439 block,
22422 src,22440 sema.src,
22423 panic_messages_ty.getNamespace().?,22441 panic_messages_ty.getNamespace().?,
22424 @tagName(panic_id),22442 @tagName(panic_id),
22425 )).?;22443 )).?;
2242622444
22427 const msg_inst = try sema.analyzeDeclVal(block, src, msg_decl_index);22445 const msg_inst = try sema.analyzeDeclVal(block, sema.src, msg_decl_index);
22428 return sema.panicWithMsg(block, src, msg_inst);22446 try sema.panicWithMsg(block, sema.src, msg_inst);
22429}22447}
2243022448
22431fn emitBackwardBranch(sema: *Sema, block: *Block, src: LazySrcLoc) !void {22449fn emitBackwardBranch(sema: *Sema, block: *Block, src: LazySrcLoc) !void {
src/main.zig+8
...@@ -406,6 +406,8 @@ const usage_build_generic =...@@ -406,6 +406,8 @@ const usage_build_generic =
406 \\ -fno-function-sections All functions go into same section406 \\ -fno-function-sections All functions go into same section
407 \\ -fstrip Omit debug symbols407 \\ -fstrip Omit debug symbols
408 \\ -fno-strip Keep debug symbols408 \\ -fno-strip Keep debug symbols
409 \\ -fformatted-panics Enable formatted safety panics
410 \\ -fno-formatted-panics Disable formatted safety panics
409 \\ -ofmt=[mode] Override target object format411 \\ -ofmt=[mode] Override target object format
410 \\ elf Executable and Linking Format412 \\ elf Executable and Linking Format
411 \\ c C source code413 \\ c C source code
...@@ -632,6 +634,7 @@ fn buildOutputType(...@@ -632,6 +634,7 @@ fn buildOutputType(
632 var have_version = false;634 var have_version = false;
633 var compatibility_version: ?std.builtin.Version = null;635 var compatibility_version: ?std.builtin.Version = null;
634 var strip: ?bool = null;636 var strip: ?bool = null;
637 var formatted_panics: ?bool = null;
635 var function_sections = false;638 var function_sections = false;
636 var no_builtin = false;639 var no_builtin = false;
637 var watch = false;640 var watch = false;
...@@ -1242,6 +1245,10 @@ fn buildOutputType(...@@ -1242,6 +1245,10 @@ fn buildOutputType(
1242 strip = true;1245 strip = true;
1243 } else if (mem.eql(u8, arg, "-fno-strip")) {1246 } else if (mem.eql(u8, arg, "-fno-strip")) {
1244 strip = false;1247 strip = false;
1248 } else if (mem.eql(u8, arg, "-fformatted-panics")) {
1249 formatted_panics = true;
1250 } else if (mem.eql(u8, arg, "-fno-formatted-panics")) {
1251 formatted_panics = false;
1245 } else if (mem.eql(u8, arg, "-fsingle-threaded")) {1252 } else if (mem.eql(u8, arg, "-fsingle-threaded")) {
1246 single_threaded = true;1253 single_threaded = true;
1247 } else if (mem.eql(u8, arg, "-fno-single-threaded")) {1254 } else if (mem.eql(u8, arg, "-fno-single-threaded")) {
...@@ -2938,6 +2945,7 @@ fn buildOutputType(...@@ -2938,6 +2945,7 @@ fn buildOutputType(
2938 .stack_size_override = stack_size_override,2945 .stack_size_override = stack_size_override,
2939 .image_base_override = image_base_override,2946 .image_base_override = image_base_override,
2940 .strip = strip,2947 .strip = strip,
2948 .formatted_panics = formatted_panics,
2941 .single_threaded = single_threaded,2949 .single_threaded = single_threaded,
2942 .function_sections = function_sections,2950 .function_sections = function_sections,
2943 .no_builtin = no_builtin,2951 .no_builtin = no_builtin,