| ... | ... | @@ -46,6 +46,7 @@ stage1_cache_manifest: *Cache.Manifest = undefined, |
| 46 | 46 | link_error_flags: link.File.ErrorFlags = .{}, |
| 47 | 47 | |
| 48 | 48 | work_queue: std.fifo.LinearFifo(Job, .Dynamic), |
| 49 | anon_work_queue: std.fifo.LinearFifo(Job, .Dynamic), |
| 49 | 50 | |
| 50 | 51 | /// These jobs are to invoke the Clang compiler to create an object file, which |
| 51 | 52 | /// gets linked with the Compilation. |
| ... | ... | @@ -1460,6 +1461,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 1460 | 1461 | .emit_analysis = options.emit_analysis, |
| 1461 | 1462 | .emit_docs = options.emit_docs, |
| 1462 | 1463 | .work_queue = std.fifo.LinearFifo(Job, .Dynamic).init(gpa), |
| 1464 | .anon_work_queue = std.fifo.LinearFifo(Job, .Dynamic).init(gpa), |
| 1463 | 1465 | .c_object_work_queue = std.fifo.LinearFifo(*CObject, .Dynamic).init(gpa), |
| 1464 | 1466 | .astgen_work_queue = std.fifo.LinearFifo(*Module.File, .Dynamic).init(gpa), |
| 1465 | 1467 | .embed_file_work_queue = std.fifo.LinearFifo(*Module.EmbedFile, .Dynamic).init(gpa), |
| ... | ... | @@ -1646,6 +1648,7 @@ pub fn destroy(self: *Compilation) void { |
| 1646 | 1648 | |
| 1647 | 1649 | const gpa = self.gpa; |
| 1648 | 1650 | self.work_queue.deinit(); |
| 1651 | self.anon_work_queue.deinit(); |
| 1649 | 1652 | self.c_object_work_queue.deinit(); |
| 1650 | 1653 | self.astgen_work_queue.deinit(); |
| 1651 | 1654 | self.embed_file_work_queue.deinit(); |
| ... | ... | @@ -2072,7 +2075,6 @@ pub fn getCompileLogOutput(self: *Compilation) []const u8 { |
| 2072 | 2075 | } |
| 2073 | 2076 | |
| 2074 | 2077 | pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemory }!void { |
| 2075 | | const gpa = self.gpa; |
| 2076 | 2078 | // If the terminal is dumb, we dont want to show the user all the |
| 2077 | 2079 | // output. |
| 2078 | 2080 | var progress: std.Progress = .{ .dont_print_on_dumb = true }; |
| ... | ... | @@ -2146,7 +2148,24 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2146 | 2148 | } |
| 2147 | 2149 | } |
| 2148 | 2150 | |
| 2149 | | while (self.work_queue.readItem()) |work_item| switch (work_item) { |
| 2151 | // In this main loop we give priority to non-anonymous Decls in the work queue, so |
| 2152 | // that they can establish references to anonymous Decls, setting alive=true in the |
| 2153 | // backend, preventing anonymous Decls from being prematurely destroyed. |
| 2154 | while (true) { |
| 2155 | if (self.work_queue.readItem()) |work_item| { |
| 2156 | try processOneJob(self, work_item, main_progress_node); |
| 2157 | continue; |
| 2158 | } |
| 2159 | if (self.anon_work_queue.readItem()) |work_item| { |
| 2160 | try processOneJob(self, work_item, main_progress_node); |
| 2161 | continue; |
| 2162 | } |
| 2163 | break; |
| 2164 | } |
| 2165 | } |
| 2166 | |
| 2167 | fn processOneJob(comp: *Compilation, job: Job, main_progress_node: *std.Progress.Node) !void { |
| 2168 | switch (job) { |
| 2150 | 2169 | .codegen_decl => |decl| switch (decl.analysis) { |
| 2151 | 2170 | .unreferenced => unreachable, |
| 2152 | 2171 | .in_progress => unreachable, |
| ... | ... | @@ -2157,24 +2176,25 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2157 | 2176 | .codegen_failure, |
| 2158 | 2177 | .dependency_failure, |
| 2159 | 2178 | .sema_failure_retryable, |
| 2160 | | => continue, |
| 2179 | => return, |
| 2161 | 2180 | |
| 2162 | 2181 | .complete, .codegen_failure_retryable => { |
| 2163 | 2182 | if (build_options.omit_stage2) |
| 2164 | 2183 | @panic("sadly stage2 is omitted from this build to save memory on the CI server"); |
| 2165 | 2184 | |
| 2166 | | const module = self.bin_file.options.module.?; |
| 2185 | const module = comp.bin_file.options.module.?; |
| 2167 | 2186 | assert(decl.has_tv); |
| 2168 | 2187 | assert(decl.ty.hasCodeGenBits()); |
| 2169 | 2188 | |
| 2170 | 2189 | if (decl.alive) { |
| 2171 | 2190 | try module.linkerUpdateDecl(decl); |
| 2172 | | continue; |
| 2191 | return; |
| 2173 | 2192 | } |
| 2174 | 2193 | |
| 2175 | 2194 | // Instead of sending this decl to the linker, we actually will delete it |
| 2176 | 2195 | // because we found out that it in fact was never referenced. |
| 2177 | 2196 | module.deleteUnusedDecl(decl); |
| 2197 | return; |
| 2178 | 2198 | }, |
| 2179 | 2199 | }, |
| 2180 | 2200 | .codegen_func => |func| switch (func.owner_decl.analysis) { |
| ... | ... | @@ -2187,20 +2207,21 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2187 | 2207 | .codegen_failure, |
| 2188 | 2208 | .dependency_failure, |
| 2189 | 2209 | .sema_failure_retryable, |
| 2190 | | => continue, |
| 2210 | => return, |
| 2191 | 2211 | |
| 2192 | 2212 | .complete, .codegen_failure_retryable => { |
| 2193 | 2213 | if (build_options.omit_stage2) |
| 2194 | 2214 | @panic("sadly stage2 is omitted from this build to save memory on the CI server"); |
| 2195 | 2215 | switch (func.state) { |
| 2196 | | .sema_failure, .dependency_failure => continue, |
| 2216 | .sema_failure, .dependency_failure => return, |
| 2197 | 2217 | .queued => {}, |
| 2198 | 2218 | .in_progress => unreachable, |
| 2199 | 2219 | .inline_only => unreachable, // don't queue work for this |
| 2200 | 2220 | .success => unreachable, // don't queue it twice |
| 2201 | 2221 | } |
| 2202 | 2222 | |
| 2203 | | const module = self.bin_file.options.module.?; |
| 2223 | const gpa = comp.gpa; |
| 2224 | const module = comp.bin_file.options.module.?; |
| 2204 | 2225 | const decl = func.owner_decl; |
| 2205 | 2226 | |
| 2206 | 2227 | var tmp_arena = std.heap.ArenaAllocator.init(gpa); |
| ... | ... | @@ -2210,7 +2231,7 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2210 | 2231 | var air = module.analyzeFnBody(decl, func, sema_arena) catch |err| switch (err) { |
| 2211 | 2232 | error.AnalysisFail => { |
| 2212 | 2233 | assert(func.state != .in_progress); |
| 2213 | | continue; |
| 2234 | return; |
| 2214 | 2235 | }, |
| 2215 | 2236 | error.OutOfMemory => return error.OutOfMemory, |
| 2216 | 2237 | }; |
| ... | ... | @@ -2220,17 +2241,17 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2220 | 2241 | var liveness = try Liveness.analyze(gpa, air, decl.getFileScope().zir); |
| 2221 | 2242 | defer liveness.deinit(gpa); |
| 2222 | 2243 | |
| 2223 | | if (builtin.mode == .Debug and self.verbose_air) { |
| 2244 | if (builtin.mode == .Debug and comp.verbose_air) { |
| 2224 | 2245 | std.debug.print("# Begin Function AIR: {s}:\n", .{decl.name}); |
| 2225 | 2246 | @import("print_air.zig").dump(gpa, air, decl.getFileScope().zir, liveness); |
| 2226 | 2247 | std.debug.print("# End Function AIR: {s}\n\n", .{decl.name}); |
| 2227 | 2248 | } |
| 2228 | 2249 | |
| 2229 | | self.bin_file.updateFunc(module, func, air, liveness) catch |err| switch (err) { |
| 2250 | comp.bin_file.updateFunc(module, func, air, liveness) catch |err| switch (err) { |
| 2230 | 2251 | error.OutOfMemory => return error.OutOfMemory, |
| 2231 | 2252 | error.AnalysisFail => { |
| 2232 | 2253 | decl.analysis = .codegen_failure; |
| 2233 | | continue; |
| 2254 | return; |
| 2234 | 2255 | }, |
| 2235 | 2256 | else => { |
| 2236 | 2257 | try module.failed_decls.ensureUnusedCapacity(gpa, 1); |
| ... | ... | @@ -2241,10 +2262,10 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2241 | 2262 | .{@errorName(err)}, |
| 2242 | 2263 | )); |
| 2243 | 2264 | decl.analysis = .codegen_failure_retryable; |
| 2244 | | continue; |
| 2265 | return; |
| 2245 | 2266 | }, |
| 2246 | 2267 | }; |
| 2247 | | continue; |
| 2268 | return; |
| 2248 | 2269 | }, |
| 2249 | 2270 | }, |
| 2250 | 2271 | .emit_h_decl => |decl| switch (decl.analysis) { |
| ... | ... | @@ -2256,14 +2277,15 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2256 | 2277 | .sema_failure, |
| 2257 | 2278 | .dependency_failure, |
| 2258 | 2279 | .sema_failure_retryable, |
| 2259 | | => continue, |
| 2280 | => return, |
| 2260 | 2281 | |
| 2261 | 2282 | // emit-h only requires semantic analysis of the Decl to be complete, |
| 2262 | 2283 | // it does not depend on machine code generation to succeed. |
| 2263 | 2284 | .codegen_failure, .codegen_failure_retryable, .complete => { |
| 2264 | 2285 | if (build_options.omit_stage2) |
| 2265 | 2286 | @panic("sadly stage2 is omitted from this build to save memory on the CI server"); |
| 2266 | | const module = self.bin_file.options.module.?; |
| 2287 | const gpa = comp.gpa; |
| 2288 | const module = comp.bin_file.options.module.?; |
| 2267 | 2289 | const emit_h = module.emit_h.?; |
| 2268 | 2290 | _ = try emit_h.decl_table.getOrPut(gpa, decl); |
| 2269 | 2291 | const decl_emit_h = decl.getEmitH(module); |
| ... | ... | @@ -2287,7 +2309,7 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2287 | 2309 | c_codegen.genHeader(&dg) catch |err| switch (err) { |
| 2288 | 2310 | error.AnalysisFail => { |
| 2289 | 2311 | try emit_h.failed_decls.put(gpa, decl, dg.error_msg.?); |
| 2290 | | continue; |
| 2312 | return; |
| 2291 | 2313 | }, |
| 2292 | 2314 | else => |e| return e, |
| 2293 | 2315 | }; |
| ... | ... | @@ -2299,26 +2321,27 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2299 | 2321 | .analyze_decl => |decl| { |
| 2300 | 2322 | if (build_options.omit_stage2) |
| 2301 | 2323 | @panic("sadly stage2 is omitted from this build to save memory on the CI server"); |
| 2302 | | const module = self.bin_file.options.module.?; |
| 2324 | const module = comp.bin_file.options.module.?; |
| 2303 | 2325 | module.ensureDeclAnalyzed(decl) catch |err| switch (err) { |
| 2304 | 2326 | error.OutOfMemory => return error.OutOfMemory, |
| 2305 | | error.AnalysisFail => continue, |
| 2327 | error.AnalysisFail => return, |
| 2306 | 2328 | }; |
| 2307 | 2329 | }, |
| 2308 | 2330 | .update_embed_file => |embed_file| { |
| 2309 | 2331 | if (build_options.omit_stage2) |
| 2310 | 2332 | @panic("sadly stage2 is omitted from this build to save memory on the CI server"); |
| 2311 | | const module = self.bin_file.options.module.?; |
| 2333 | const module = comp.bin_file.options.module.?; |
| 2312 | 2334 | module.updateEmbedFile(embed_file) catch |err| switch (err) { |
| 2313 | 2335 | error.OutOfMemory => return error.OutOfMemory, |
| 2314 | | error.AnalysisFail => continue, |
| 2336 | error.AnalysisFail => return, |
| 2315 | 2337 | }; |
| 2316 | 2338 | }, |
| 2317 | 2339 | .update_line_number => |decl| { |
| 2318 | 2340 | if (build_options.omit_stage2) |
| 2319 | 2341 | @panic("sadly stage2 is omitted from this build to save memory on the CI server"); |
| 2320 | | const module = self.bin_file.options.module.?; |
| 2321 | | self.bin_file.updateDeclLineNumber(module, decl) catch |err| { |
| 2342 | const gpa = comp.gpa; |
| 2343 | const module = comp.bin_file.options.module.?; |
| 2344 | comp.bin_file.updateDeclLineNumber(module, decl) catch |err| { |
| 2322 | 2345 | try module.failed_decls.ensureUnusedCapacity(gpa, 1); |
| 2323 | 2346 | module.failed_decls.putAssumeCapacityNoClobber(decl, try Module.ErrorMsg.create( |
| 2324 | 2347 | gpa, |
| ... | ... | @@ -2332,31 +2355,31 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2332 | 2355 | .analyze_pkg => |pkg| { |
| 2333 | 2356 | if (build_options.omit_stage2) |
| 2334 | 2357 | @panic("sadly stage2 is omitted from this build to save memory on the CI server"); |
| 2335 | | const module = self.bin_file.options.module.?; |
| 2358 | const module = comp.bin_file.options.module.?; |
| 2336 | 2359 | module.semaPkg(pkg) catch |err| switch (err) { |
| 2337 | 2360 | error.CurrentWorkingDirectoryUnlinked, |
| 2338 | 2361 | error.Unexpected, |
| 2339 | | => try self.setMiscFailure( |
| 2362 | => try comp.setMiscFailure( |
| 2340 | 2363 | .analyze_pkg, |
| 2341 | 2364 | "unexpected problem analyzing package '{s}'", |
| 2342 | 2365 | .{pkg.root_src_path}, |
| 2343 | 2366 | ), |
| 2344 | 2367 | error.OutOfMemory => return error.OutOfMemory, |
| 2345 | | error.AnalysisFail => continue, |
| 2368 | error.AnalysisFail => return, |
| 2346 | 2369 | }; |
| 2347 | 2370 | }, |
| 2348 | 2371 | .glibc_crt_file => |crt_file| { |
| 2349 | | glibc.buildCRTFile(self, crt_file) catch |err| { |
| 2372 | glibc.buildCRTFile(comp, crt_file) catch |err| { |
| 2350 | 2373 | // TODO Surface more error details. |
| 2351 | | try self.setMiscFailure(.glibc_crt_file, "unable to build glibc CRT file: {s}", .{ |
| 2374 | try comp.setMiscFailure(.glibc_crt_file, "unable to build glibc CRT file: {s}", .{ |
| 2352 | 2375 | @errorName(err), |
| 2353 | 2376 | }); |
| 2354 | 2377 | }; |
| 2355 | 2378 | }, |
| 2356 | 2379 | .glibc_shared_objects => { |
| 2357 | | glibc.buildSharedObjects(self) catch |err| { |
| 2380 | glibc.buildSharedObjects(comp) catch |err| { |
| 2358 | 2381 | // TODO Surface more error details. |
| 2359 | | try self.setMiscFailure( |
| 2382 | try comp.setMiscFailure( |
| 2360 | 2383 | .glibc_shared_objects, |
| 2361 | 2384 | "unable to build glibc shared objects: {s}", |
| 2362 | 2385 | .{@errorName(err)}, |
| ... | ... | @@ -2364,9 +2387,9 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2364 | 2387 | }; |
| 2365 | 2388 | }, |
| 2366 | 2389 | .musl_crt_file => |crt_file| { |
| 2367 | | musl.buildCRTFile(self, crt_file) catch |err| { |
| 2390 | musl.buildCRTFile(comp, crt_file) catch |err| { |
| 2368 | 2391 | // TODO Surface more error details. |
| 2369 | | try self.setMiscFailure( |
| 2392 | try comp.setMiscFailure( |
| 2370 | 2393 | .musl_crt_file, |
| 2371 | 2394 | "unable to build musl CRT file: {s}", |
| 2372 | 2395 | .{@errorName(err)}, |
| ... | ... | @@ -2374,9 +2397,9 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2374 | 2397 | }; |
| 2375 | 2398 | }, |
| 2376 | 2399 | .mingw_crt_file => |crt_file| { |
| 2377 | | mingw.buildCRTFile(self, crt_file) catch |err| { |
| 2400 | mingw.buildCRTFile(comp, crt_file) catch |err| { |
| 2378 | 2401 | // TODO Surface more error details. |
| 2379 | | try self.setMiscFailure( |
| 2402 | try comp.setMiscFailure( |
| 2380 | 2403 | .mingw_crt_file, |
| 2381 | 2404 | "unable to build mingw-w64 CRT file: {s}", |
| 2382 | 2405 | .{@errorName(err)}, |
| ... | ... | @@ -2384,10 +2407,10 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2384 | 2407 | }; |
| 2385 | 2408 | }, |
| 2386 | 2409 | .windows_import_lib => |index| { |
| 2387 | | const link_lib = self.bin_file.options.system_libs.keys()[index]; |
| 2388 | | mingw.buildImportLib(self, link_lib) catch |err| { |
| 2410 | const link_lib = comp.bin_file.options.system_libs.keys()[index]; |
| 2411 | mingw.buildImportLib(comp, link_lib) catch |err| { |
| 2389 | 2412 | // TODO Surface more error details. |
| 2390 | | try self.setMiscFailure( |
| 2413 | try comp.setMiscFailure( |
| 2391 | 2414 | .windows_import_lib, |
| 2392 | 2415 | "unable to generate DLL import .lib file: {s}", |
| 2393 | 2416 | .{@errorName(err)}, |
| ... | ... | @@ -2395,9 +2418,9 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2395 | 2418 | }; |
| 2396 | 2419 | }, |
| 2397 | 2420 | .libunwind => { |
| 2398 | | libunwind.buildStaticLib(self) catch |err| { |
| 2421 | libunwind.buildStaticLib(comp) catch |err| { |
| 2399 | 2422 | // TODO Surface more error details. |
| 2400 | | try self.setMiscFailure( |
| 2423 | try comp.setMiscFailure( |
| 2401 | 2424 | .libunwind, |
| 2402 | 2425 | "unable to build libunwind: {s}", |
| 2403 | 2426 | .{@errorName(err)}, |
| ... | ... | @@ -2405,9 +2428,9 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2405 | 2428 | }; |
| 2406 | 2429 | }, |
| 2407 | 2430 | .libcxx => { |
| 2408 | | libcxx.buildLibCXX(self) catch |err| { |
| 2431 | libcxx.buildLibCXX(comp) catch |err| { |
| 2409 | 2432 | // TODO Surface more error details. |
| 2410 | | try self.setMiscFailure( |
| 2433 | try comp.setMiscFailure( |
| 2411 | 2434 | .libcxx, |
| 2412 | 2435 | "unable to build libcxx: {s}", |
| 2413 | 2436 | .{@errorName(err)}, |
| ... | ... | @@ -2415,9 +2438,9 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2415 | 2438 | }; |
| 2416 | 2439 | }, |
| 2417 | 2440 | .libcxxabi => { |
| 2418 | | libcxx.buildLibCXXABI(self) catch |err| { |
| 2441 | libcxx.buildLibCXXABI(comp) catch |err| { |
| 2419 | 2442 | // TODO Surface more error details. |
| 2420 | | try self.setMiscFailure( |
| 2443 | try comp.setMiscFailure( |
| 2421 | 2444 | .libcxxabi, |
| 2422 | 2445 | "unable to build libcxxabi: {s}", |
| 2423 | 2446 | .{@errorName(err)}, |
| ... | ... | @@ -2425,9 +2448,9 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2425 | 2448 | }; |
| 2426 | 2449 | }, |
| 2427 | 2450 | .libtsan => { |
| 2428 | | libtsan.buildTsan(self) catch |err| { |
| 2451 | libtsan.buildTsan(comp) catch |err| { |
| 2429 | 2452 | // TODO Surface more error details. |
| 2430 | | try self.setMiscFailure( |
| 2453 | try comp.setMiscFailure( |
| 2431 | 2454 | .libtsan, |
| 2432 | 2455 | "unable to build TSAN library: {s}", |
| 2433 | 2456 | .{@errorName(err)}, |
| ... | ... | @@ -2435,9 +2458,9 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2435 | 2458 | }; |
| 2436 | 2459 | }, |
| 2437 | 2460 | .wasi_libc_crt_file => |crt_file| { |
| 2438 | | wasi_libc.buildCRTFile(self, crt_file) catch |err| { |
| 2461 | wasi_libc.buildCRTFile(comp, crt_file) catch |err| { |
| 2439 | 2462 | // TODO Surface more error details. |
| 2440 | | try self.setMiscFailure( |
| 2463 | try comp.setMiscFailure( |
| 2441 | 2464 | .wasi_libc_crt_file, |
| 2442 | 2465 | "unable to build WASI libc CRT file: {s}", |
| 2443 | 2466 | .{@errorName(err)}, |
| ... | ... | @@ -2445,15 +2468,15 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2445 | 2468 | }; |
| 2446 | 2469 | }, |
| 2447 | 2470 | .compiler_rt_lib => { |
| 2448 | | self.buildOutputFromZig( |
| 2471 | comp.buildOutputFromZig( |
| 2449 | 2472 | "compiler_rt.zig", |
| 2450 | 2473 | .Lib, |
| 2451 | | &self.compiler_rt_static_lib, |
| 2474 | &comp.compiler_rt_static_lib, |
| 2452 | 2475 | .compiler_rt, |
| 2453 | 2476 | ) catch |err| switch (err) { |
| 2454 | 2477 | error.OutOfMemory => return error.OutOfMemory, |
| 2455 | | error.SubCompilationFailed => continue, // error reported already |
| 2456 | | else => try self.setMiscFailure( |
| 2478 | error.SubCompilationFailed => return, // error reported already |
| 2479 | else => try comp.setMiscFailure( |
| 2457 | 2480 | .compiler_rt, |
| 2458 | 2481 | "unable to build compiler_rt: {s}", |
| 2459 | 2482 | .{@errorName(err)}, |
| ... | ... | @@ -2461,15 +2484,15 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2461 | 2484 | }; |
| 2462 | 2485 | }, |
| 2463 | 2486 | .compiler_rt_obj => { |
| 2464 | | self.buildOutputFromZig( |
| 2487 | comp.buildOutputFromZig( |
| 2465 | 2488 | "compiler_rt.zig", |
| 2466 | 2489 | .Obj, |
| 2467 | | &self.compiler_rt_obj, |
| 2490 | &comp.compiler_rt_obj, |
| 2468 | 2491 | .compiler_rt, |
| 2469 | 2492 | ) catch |err| switch (err) { |
| 2470 | 2493 | error.OutOfMemory => return error.OutOfMemory, |
| 2471 | | error.SubCompilationFailed => continue, // error reported already |
| 2472 | | else => try self.setMiscFailure( |
| 2494 | error.SubCompilationFailed => return, // error reported already |
| 2495 | else => try comp.setMiscFailure( |
| 2473 | 2496 | .compiler_rt, |
| 2474 | 2497 | "unable to build compiler_rt: {s}", |
| 2475 | 2498 | .{@errorName(err)}, |
| ... | ... | @@ -2477,15 +2500,15 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2477 | 2500 | }; |
| 2478 | 2501 | }, |
| 2479 | 2502 | .libssp => { |
| 2480 | | self.buildOutputFromZig( |
| 2503 | comp.buildOutputFromZig( |
| 2481 | 2504 | "ssp.zig", |
| 2482 | 2505 | .Lib, |
| 2483 | | &self.libssp_static_lib, |
| 2506 | &comp.libssp_static_lib, |
| 2484 | 2507 | .libssp, |
| 2485 | 2508 | ) catch |err| switch (err) { |
| 2486 | 2509 | error.OutOfMemory => return error.OutOfMemory, |
| 2487 | | error.SubCompilationFailed => continue, // error reported already |
| 2488 | | else => try self.setMiscFailure( |
| 2510 | error.SubCompilationFailed => return, // error reported already |
| 2511 | else => try comp.setMiscFailure( |
| 2489 | 2512 | .libssp, |
| 2490 | 2513 | "unable to build libssp: {s}", |
| 2491 | 2514 | .{@errorName(err)}, |
| ... | ... | @@ -2493,15 +2516,15 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2493 | 2516 | }; |
| 2494 | 2517 | }, |
| 2495 | 2518 | .zig_libc => { |
| 2496 | | self.buildOutputFromZig( |
| 2519 | comp.buildOutputFromZig( |
| 2497 | 2520 | "c.zig", |
| 2498 | 2521 | .Lib, |
| 2499 | | &self.libc_static_lib, |
| 2522 | &comp.libc_static_lib, |
| 2500 | 2523 | .zig_libc, |
| 2501 | 2524 | ) catch |err| switch (err) { |
| 2502 | 2525 | error.OutOfMemory => return error.OutOfMemory, |
| 2503 | | error.SubCompilationFailed => continue, // error reported already |
| 2504 | | else => try self.setMiscFailure( |
| 2526 | error.SubCompilationFailed => return, // error reported already |
| 2527 | else => try comp.setMiscFailure( |
| 2505 | 2528 | .zig_libc, |
| 2506 | 2529 | "unable to build zig's multitarget libc: {s}", |
| 2507 | 2530 | .{@errorName(err)}, |
| ... | ... | @@ -2512,11 +2535,11 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 2512 | 2535 | if (!build_options.is_stage1) |
| 2513 | 2536 | unreachable; |
| 2514 | 2537 | |
| 2515 | | self.updateStage1Module(main_progress_node) catch |err| { |
| 2538 | comp.updateStage1Module(main_progress_node) catch |err| { |
| 2516 | 2539 | fatal("unable to build stage1 zig object: {s}", .{@errorName(err)}); |
| 2517 | 2540 | }; |
| 2518 | 2541 | }, |
| 2519 | | }; |
| 2542 | } |
| 2520 | 2543 | } |
| 2521 | 2544 | |
| 2522 | 2545 | const AstGenSrc = union(enum) { |