| ... | @@ -336,7 +336,7 @@ pub const Object = struct { | ... | @@ -336,7 +336,7 @@ pub const Object = struct { |
| 336 | bin_path: ?[:0]const u8, | 336 | bin_path: ?[:0]const u8, |
| 337 | asm_path: ?[:0]const u8, | 337 | asm_path: ?[:0]const u8, |
| 338 | post_ir_path: ?[:0]const u8, | 338 | post_ir_path: ?[:0]const u8, |
| 339 | post_bc_path: ?[]const u8, | 339 | post_bc_path: ?[:0]const u8, |
| 340 | | 340 | |
| 341 | is_debug: bool, | 341 | is_debug: bool, |
| 342 | is_small: bool, | 342 | is_small: bool, |
| ... | @@ -543,24 +543,13 @@ pub const Object = struct { | ... | @@ -543,24 +543,13 @@ pub const Object = struct { |
| 543 | return diags.fail("failed to create '{s}': {t}", .{ path, err }); | 543 | return diags.fail("failed to create '{s}': {t}", .{ path, err }); |
| 544 | defer file.close(io); | 544 | defer file.close(io); |
| 545 | | 545 | |
| 546 | const ptr: [*]const u8 = @ptrCast(bitcode.ptr); | 546 | file.writeStreamingAll(io, @ptrCast(bitcode)) catch |err| |
| 547 | file.writeStreamingAll(io, ptr[0..(bitcode.len * 4)]) catch |err| | | |
| 548 | return diags.fail("failed to write to '{s}': {t}", .{ path, err }); | 547 | return diags.fail("failed to write to '{s}': {t}", .{ path, err }); |
| 549 | } | 548 | } |
| 550 | | 549 | |
| 551 | if (options.asm_path == null and options.bin_path == null and | 550 | if (options.asm_path == null and options.bin_path == null and |
| 552 | options.post_ir_path == null and options.post_bc_path == null) return; | 551 | options.post_ir_path == null and options.post_bc_path == null) return; |
| 553 | | 552 | |
| 554 | if (options.post_bc_path) |path| { | | |
| 555 | var file = Io.Dir.cwd().createFile(io, path, .{}) catch |err| | | |
| 556 | return diags.fail("failed to create '{s}': {t}", .{ path, err }); | | |
| 557 | defer file.close(io); | | |
| 558 | | | |
| 559 | const ptr: [*]const u8 = @ptrCast(bitcode.ptr); | | |
| 560 | file.writeStreamingAll(io, ptr[0..(bitcode.len * 4)]) catch |err| | | |
| 561 | return diags.fail("failed to write to '{s}': {t}", .{ path, err }); | | |
| 562 | } | | |
| 563 | | | |
| 564 | if (!build_options.have_llvm or !comp.config.use_lib_llvm) { | 553 | if (!build_options.have_llvm or !comp.config.use_lib_llvm) { |
| 565 | return diags.fail("emitting without libllvm not implemented", .{}); | 554 | return diags.fail("emitting without libllvm not implemented", .{}); |
| 566 | } | 555 | } |
| ... | @@ -663,7 +652,7 @@ pub const Object = struct { | ... | @@ -663,7 +652,7 @@ pub const Object = struct { |
| 663 | .asm_filename = null, | 652 | .asm_filename = null, |
| 664 | .bin_filename = if (options.bin_path) |x| x.ptr else null, | 653 | .bin_filename = if (options.bin_path) |x| x.ptr else null, |
| 665 | .llvm_ir_filename = if (options.post_ir_path) |x| x.ptr else null, | 654 | .llvm_ir_filename = if (options.post_ir_path) |x| x.ptr else null, |
| 666 | .bitcode_filename = null, | 655 | .bitcode_filename = if (options.post_bc_path) |x| x.ptr else null, |
| 667 | | 656 | |
| 668 | // `.coverage` value is only used when `.sancov` is enabled. | 657 | // `.coverage` value is only used when `.sancov` is enabled. |
| 669 | .sancov = options.fuzz or comp.config.san_cov_trace_pc_guard, | 658 | .sancov = options.fuzz or comp.config.san_cov_trace_pc_guard, |
| ... | @@ -702,6 +691,7 @@ pub const Object = struct { | ... | @@ -702,6 +691,7 @@ pub const Object = struct { |
| 702 | } | 691 | } |
| 703 | lowered_options.bin_filename = null; | 692 | lowered_options.bin_filename = null; |
| 704 | lowered_options.llvm_ir_filename = null; | 693 | lowered_options.llvm_ir_filename = null; |
| | 694 | lowered_options.bitcode_filename = null; |
| 705 | } | 695 | } |
| 706 | | 696 | |
| 707 | var time_report_c_str: [*:0]u8 = undefined; | 697 | var time_report_c_str: [*:0]u8 = undefined; |