| ... | @@ -1112,13 +1112,22 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { | ... | @@ -1112,13 +1112,22 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1112 | | 1112 | |
| 1113 | const include_compiler_rt = options.want_compiler_rt orelse needs_c_symbols; | 1113 | const include_compiler_rt = options.want_compiler_rt orelse needs_c_symbols; |
| 1114 | | 1114 | |
| 1115 | const must_single_thread = target_util.isSingleThreaded(options.target); | 1115 | const single_threaded = st: { |
| 1116 | const single_threaded = options.single_threaded orelse must_single_thread or | 1116 | if (target_util.isSingleThreaded(options.target)) { |
| 1117 | // x86_64 codegen doesn't support TLV for most object formats | 1117 | if (options.single_threaded == false) |
| 1118 | (!use_llvm and options.target.cpu.arch == .x86_64 and options.target.ofmt != .macho); | 1118 | return error.TargetRequiresSingleThreaded; |
| 1119 | if (must_single_thread and !single_threaded) { | 1119 | break :st true; |
| 1120 | return error.TargetRequiresSingleThreaded; | 1120 | } |
| 1121 | } | 1121 | if (options.main_mod != null) { |
| | 1122 | const zig_backend = zigBackend(options.target, use_llvm); |
| | 1123 | if (!target_util.supportsThreads(options.target, zig_backend)) { |
| | 1124 | if (options.single_threaded == false) |
| | 1125 | return error.BackendRequiresSingleThreaded; |
| | 1126 | break :st true; |
| | 1127 | } |
| | 1128 | } |
| | 1129 | break :st options.single_threaded orelse false; |
| | 1130 | }; |
| 1122 | | 1131 | |
| 1123 | const llvm_cpu_features: ?[*:0]const u8 = if (use_llvm) blk: { | 1132 | const llvm_cpu_features: ?[*:0]const u8 = if (use_llvm) blk: { |
| 1124 | var buf = std.ArrayList(u8).init(arena); | 1133 | var buf = std.ArrayList(u8).init(arena); |