| ... | @@ -1352,8 +1352,8 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -1352,8 +1352,8 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 1352 | // approach, since the ubsan runtime uses quite a lot of the standard library | 1352 | // approach, since the ubsan runtime uses quite a lot of the standard library |
| 1353 | // and this reduces unnecessary bloat. | 1353 | // and this reduces unnecessary bloat. |
| 1354 | const ubsan_rt_strat: RtStrat = s: { | 1354 | const ubsan_rt_strat: RtStrat = s: { |
| 1355 | const is_spirv = options.root_mod.resolved_target.result.cpu.arch.isSpirV(); | 1355 | const can_build_ubsan_rt = target_util.canBuildLibUbsanRt(options.root_mod.resolved_target.result); |
| 1356 | const want_ubsan_rt = options.want_ubsan_rt orelse (!is_spirv and any_sanitize_c == .full and is_exe_or_dyn_lib); | 1356 | const want_ubsan_rt = options.want_ubsan_rt orelse (can_build_ubsan_rt and any_sanitize_c == .full and is_exe_or_dyn_lib); |
| 1357 | if (!want_ubsan_rt) break :s .none; | 1357 | if (!want_ubsan_rt) break :s .none; |
| 1358 | if (options.skip_linker_dependencies) break :s .none; | 1358 | if (options.skip_linker_dependencies) break :s .none; |
| 1359 | if (have_zcu) break :s .zcu; | 1359 | if (have_zcu) break :s .zcu; |
| ... | @@ -1768,8 +1768,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -1768,8 +1768,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 1768 | errdefer comp.destroy(); | 1768 | errdefer comp.destroy(); |
| 1769 | | 1769 | |
| 1770 | const target = comp.root_mod.resolved_target.result; | 1770 | const target = comp.root_mod.resolved_target.result; |
| 1771 | | 1771 | const can_build_compiler_rt = target_util.canBuildLibCompilerRt(target, comp.config.use_llvm, build_options.have_llvm); |
| 1772 | const capable_of_building_compiler_rt = canBuildLibCompilerRt(target, comp.config.use_llvm); | | |
| 1773 | | 1772 | |
| 1774 | // Add a `CObject` for each `c_source_files`. | 1773 | // Add a `CObject` for each `c_source_files`. |
| 1775 | try comp.c_object_table.ensureTotalCapacity(gpa, options.c_source_files.len); | 1774 | try comp.c_object_table.ensureTotalCapacity(gpa, options.c_source_files.len); |
| ... | @@ -1939,7 +1938,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -1939,7 +1938,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 1939 | comp.remaining_prelink_tasks += 1; | 1938 | comp.remaining_prelink_tasks += 1; |
| 1940 | } | 1939 | } |
| 1941 | | 1940 | |
| 1942 | if (capable_of_building_compiler_rt) { | 1941 | if (can_build_compiler_rt) { |
| 1943 | if (comp.compiler_rt_strat == .lib) { | 1942 | if (comp.compiler_rt_strat == .lib) { |
| 1944 | log.debug("queuing a job to build compiler_rt_lib", .{}); | 1943 | log.debug("queuing a job to build compiler_rt_lib", .{}); |
| 1945 | comp.queued_jobs.compiler_rt_lib = true; | 1944 | comp.queued_jobs.compiler_rt_lib = true; |
| ... | @@ -6558,22 +6557,6 @@ pub fn dump_argv(argv: []const []const u8) void { | ... | @@ -6558,22 +6557,6 @@ pub fn dump_argv(argv: []const []const u8) void { |
| 6558 | nosuspend stderr.print("{s}\n", .{argv[argv.len - 1]}) catch {}; | 6557 | nosuspend stderr.print("{s}\n", .{argv[argv.len - 1]}) catch {}; |
| 6559 | } | 6558 | } |
| 6560 | | 6559 | |
| 6561 | fn canBuildLibCompilerRt(target: std.Target, use_llvm: bool) bool { | | |
| 6562 | switch (target.os.tag) { | | |
| 6563 | .plan9 => return false, | | |
| 6564 | else => {}, | | |
| 6565 | } | | |
| 6566 | switch (target.cpu.arch) { | | |
| 6567 | .spirv, .spirv32, .spirv64 => return false, | | |
| 6568 | else => {}, | | |
| 6569 | } | | |
| 6570 | return switch (target_util.zigBackend(target, use_llvm)) { | | |
| 6571 | .stage2_llvm => true, | | |
| 6572 | .stage2_x86_64 => if (target.ofmt == .elf or target.ofmt == .macho) true else build_options.have_llvm, | | |
| 6573 | else => build_options.have_llvm, | | |
| 6574 | }; | | |
| 6575 | } | | |
| 6576 | | | |
| 6577 | pub fn getZigBackend(comp: Compilation) std.builtin.CompilerBackend { | 6560 | pub fn getZigBackend(comp: Compilation) std.builtin.CompilerBackend { |
| 6578 | const target = comp.root_mod.resolved_target.result; | 6561 | const target = comp.root_mod.resolved_target.result; |
| 6579 | return target_util.zigBackend(target, comp.config.use_llvm); | 6562 | return target_util.zigBackend(target, comp.config.use_llvm); |