| ... | @@ -1635,10 +1635,25 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { | ... | @@ -1635,10 +1635,25 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1635 | } else main_pkg; | 1635 | } else main_pkg; |
| 1636 | errdefer if (options.is_test) root_pkg.destroy(gpa); | 1636 | errdefer if (options.is_test) root_pkg.destroy(gpa); |
| 1637 | | 1637 | |
| | 1638 | const compiler_rt_pkg = if (include_compiler_rt and options.output_mode == .Obj) compiler_rt_pkg: { |
| | 1639 | break :compiler_rt_pkg try Package.createWithDir( |
| | 1640 | gpa, |
| | 1641 | "compiler_rt", |
| | 1642 | options.zig_lib_directory, |
| | 1643 | null, |
| | 1644 | "compiler_rt.zig", |
| | 1645 | ); |
| | 1646 | } else null; |
| | 1647 | errdefer if (compiler_rt_pkg) |p| p.destroy(gpa); |
| | 1648 | |
| 1638 | try main_pkg.addAndAdopt(gpa, builtin_pkg); | 1649 | try main_pkg.addAndAdopt(gpa, builtin_pkg); |
| 1639 | try main_pkg.add(gpa, root_pkg); | 1650 | try main_pkg.add(gpa, root_pkg); |
| 1640 | try main_pkg.addAndAdopt(gpa, std_pkg); | 1651 | try main_pkg.addAndAdopt(gpa, std_pkg); |
| 1641 | | 1652 | |
| | 1653 | if (compiler_rt_pkg) |p| { |
| | 1654 | try main_pkg.addAndAdopt(gpa, p); |
| | 1655 | } |
| | 1656 | |
| 1642 | const main_pkg_is_std = m: { | 1657 | const main_pkg_is_std = m: { |
| 1643 | const std_path = try std.fs.path.resolve(arena, &[_][]const u8{ | 1658 | const std_path = try std.fs.path.resolve(arena, &[_][]const u8{ |
| 1644 | std_pkg.root_src_directory.path orelse ".", | 1659 | std_pkg.root_src_directory.path orelse ".", |
| ... | @@ -2355,6 +2370,10 @@ pub fn update(comp: *Compilation) !void { | ... | @@ -2355,6 +2370,10 @@ pub fn update(comp: *Compilation) !void { |
| 2355 | _ = try module.importPkg(module.main_pkg); | 2370 | _ = try module.importPkg(module.main_pkg); |
| 2356 | } | 2371 | } |
| 2357 | | 2372 | |
| | 2373 | if (module.main_pkg.table.get("compiler_rt")) |compiler_rt_pkg| { |
| | 2374 | _ = try module.importPkg(compiler_rt_pkg); |
| | 2375 | } |
| | 2376 | |
| 2358 | // Put a work item in for every known source file to detect if | 2377 | // Put a work item in for every known source file to detect if |
| 2359 | // it changed, and, if so, re-compute ZIR and then queue the job | 2378 | // it changed, and, if so, re-compute ZIR and then queue the job |
| 2360 | // to update it. | 2379 | // to update it. |
| ... | @@ -2379,6 +2398,10 @@ pub fn update(comp: *Compilation) !void { | ... | @@ -2379,6 +2398,10 @@ pub fn update(comp: *Compilation) !void { |
| 2379 | if (comp.bin_file.options.is_test) { | 2398 | if (comp.bin_file.options.is_test) { |
| 2380 | try comp.work_queue.writeItem(.{ .analyze_pkg = module.main_pkg }); | 2399 | try comp.work_queue.writeItem(.{ .analyze_pkg = module.main_pkg }); |
| 2381 | } | 2400 | } |
| | 2401 | |
| | 2402 | if (module.main_pkg.table.get("compiler_rt")) |compiler_rt_pkg| { |
| | 2403 | try comp.work_queue.writeItem(.{ .analyze_pkg = compiler_rt_pkg }); |
| | 2404 | } |
| 2382 | } | 2405 | } |
| 2383 | | 2406 | |
| 2384 | // If the terminal is dumb, we dont want to show the user all the output. | 2407 | // If the terminal is dumb, we dont want to show the user all the output. |