| author | |
| committer | |
| log | f2564318385ea90b08af044ae32ddef26e6346bd |
| tree | acb36d3268bace51f780a872f40b04da092591de |
| parent | 57afdfc8fae667e69850650ebb8606805d0d2272 |
15 files changed, 363 insertions(+), 255 deletions(-)
src/Compilation.zig+39-18| ... | @@ -1410,7 +1410,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { | ... | @@ -1410,7 +1410,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1410 | .inherited = .{}, | 1410 | .inherited = .{}, |
| 1411 | .global = options.config, | 1411 | .global = options.config, |
| 1412 | .parent = options.root_mod, | 1412 | .parent = options.root_mod, |
| 1413 | .builtin_mod = options.root_mod.deps.get("builtin").?, | 1413 | .builtin_mod = options.root_mod.getBuiltinDependency(), |
| 1414 | }); | 1414 | }); |
| 1415 | 1415 | ||
| 1416 | const zcu = try arena.create(Module); | 1416 | const zcu = try arena.create(Module); |
| ... | @@ -3830,6 +3830,7 @@ pub fn obtainCObjectCacheManifest( | ... | @@ -3830,6 +3830,7 @@ pub fn obtainCObjectCacheManifest( |
| 3830 | // that apply both to @cImport and compiling C objects. No linking stuff here! | 3830 | // that apply both to @cImport and compiling C objects. No linking stuff here! |
| 3831 | // Also nothing that applies only to compiling .zig code. | 3831 | // Also nothing that applies only to compiling .zig code. |
| 3832 | man.hash.add(owner_mod.sanitize_c); | 3832 | man.hash.add(owner_mod.sanitize_c); |
| 3833 | man.hash.add(owner_mod.sanitize_thread); | ||
| 3833 | man.hash.addListOfBytes(owner_mod.cc_argv); | 3834 | man.hash.addListOfBytes(owner_mod.cc_argv); |
| 3834 | man.hash.add(comp.config.link_libcpp); | 3835 | man.hash.add(comp.config.link_libcpp); |
| 3835 | 3836 | ||
| ... | @@ -3970,10 +3971,13 @@ pub fn cImport(comp: *Compilation, c_src: []const u8, owner_mod: *Package.Module | ... | @@ -3970,10 +3971,13 @@ pub fn cImport(comp: *Compilation, c_src: []const u8, owner_mod: *Package.Module |
| 3970 | 3971 | ||
| 3971 | const dep_basename = std.fs.path.basename(out_dep_path); | 3972 | const dep_basename = std.fs.path.basename(out_dep_path); |
| 3972 | try man.addDepFilePost(zig_cache_tmp_dir, dep_basename); | 3973 | try man.addDepFilePost(zig_cache_tmp_dir, dep_basename); |
| 3973 | if (comp.whole_cache_manifest) |whole_cache_manifest| { | 3974 | switch (comp.cache_use) { |
| 3974 | comp.whole_cache_manifest_mutex.lock(); | 3975 | .whole => |whole| if (whole.cache_manifest) |whole_cache_manifest| { |
| 3975 | defer comp.whole_cache_manifest_mutex.unlock(); | 3976 | whole.cache_manifest_mutex.lock(); |
| 3976 | try whole_cache_manifest.addDepFilePost(zig_cache_tmp_dir, dep_basename); | 3977 | defer whole.cache_manifest_mutex.unlock(); |
| 3978 | try whole_cache_manifest.addDepFilePost(zig_cache_tmp_dir, dep_basename); | ||
| 3979 | }, | ||
| 3980 | .incremental => {}, | ||
| 3977 | } | 3981 | } |
| 3978 | 3982 | ||
| 3979 | const digest = man.final(); | 3983 | const digest = man.final(); |
| ... | @@ -4425,10 +4429,15 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P | ... | @@ -4425,10 +4429,15 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P |
| 4425 | const dep_basename = std.fs.path.basename(dep_file_path); | 4429 | const dep_basename = std.fs.path.basename(dep_file_path); |
| 4426 | // Add the files depended on to the cache system. | 4430 | // Add the files depended on to the cache system. |
| 4427 | try man.addDepFilePost(zig_cache_tmp_dir, dep_basename); | 4431 | try man.addDepFilePost(zig_cache_tmp_dir, dep_basename); |
| 4428 | if (comp.whole_cache_manifest) |whole_cache_manifest| { | 4432 | switch (comp.cache_use) { |
| 4429 | comp.whole_cache_manifest_mutex.lock(); | 4433 | .whole => |whole| { |
| 4430 | defer comp.whole_cache_manifest_mutex.unlock(); | 4434 | if (whole.cache_manifest) |whole_cache_manifest| { |
| 4431 | try whole_cache_manifest.addDepFilePost(zig_cache_tmp_dir, dep_basename); | 4435 | whole.cache_manifest_mutex.lock(); |
| 4436 | defer whole.cache_manifest_mutex.unlock(); | ||
| 4437 | try whole_cache_manifest.addDepFilePost(zig_cache_tmp_dir, dep_basename); | ||
| 4438 | } | ||
| 4439 | }, | ||
| 4440 | .incremental => {}, | ||
| 4432 | } | 4441 | } |
| 4433 | // Just to save disk space, we delete the file because it is never needed again. | 4442 | // Just to save disk space, we delete the file because it is never needed again. |
| 4434 | zig_cache_tmp_dir.deleteFile(dep_basename) catch |err| { | 4443 | zig_cache_tmp_dir.deleteFile(dep_basename) catch |err| { |
| ... | @@ -4724,10 +4733,13 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 | ... | @@ -4724,10 +4733,13 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 4724 | const dep_basename = std.fs.path.basename(out_dep_path); | 4733 | const dep_basename = std.fs.path.basename(out_dep_path); |
| 4725 | // Add the files depended on to the cache system. | 4734 | // Add the files depended on to the cache system. |
| 4726 | try man.addDepFilePost(zig_cache_tmp_dir, dep_basename); | 4735 | try man.addDepFilePost(zig_cache_tmp_dir, dep_basename); |
| 4727 | if (comp.whole_cache_manifest) |whole_cache_manifest| { | 4736 | switch (comp.cache_use) { |
| 4728 | comp.whole_cache_manifest_mutex.lock(); | 4737 | .whole => |whole| if (whole.cache_manifest) |whole_cache_manifest| { |
| 4729 | defer comp.whole_cache_manifest_mutex.unlock(); | 4738 | whole.cache_manifest_mutex.lock(); |
| 4730 | try whole_cache_manifest.addDepFilePost(zig_cache_tmp_dir, dep_basename); | 4739 | defer whole.cache_manifest_mutex.unlock(); |
| 4740 | try whole_cache_manifest.addDepFilePost(zig_cache_tmp_dir, dep_basename); | ||
| 4741 | }, | ||
| 4742 | .incremental => {}, | ||
| 4731 | } | 4743 | } |
| 4732 | // Just to save disk space, we delete the file because it is never needed again. | 4744 | // Just to save disk space, we delete the file because it is never needed again. |
| 4733 | zig_cache_tmp_dir.deleteFile(dep_basename) catch |err| { | 4745 | zig_cache_tmp_dir.deleteFile(dep_basename) catch |err| { |
| ... | @@ -4799,10 +4811,13 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 | ... | @@ -4799,10 +4811,13 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 4799 | 4811 | ||
| 4800 | for (dependencies_list.items) |dep_file_path| { | 4812 | for (dependencies_list.items) |dep_file_path| { |
| 4801 | try man.addFilePost(dep_file_path); | 4813 | try man.addFilePost(dep_file_path); |
| 4802 | if (comp.whole_cache_manifest) |whole_cache_manifest| { | 4814 | switch (comp.cache_use) { |
| 4803 | comp.whole_cache_manifest_mutex.lock(); | 4815 | .whole => |whole| if (whole.cache_manifest) |whole_cache_manifest| { |
| 4804 | defer comp.whole_cache_manifest_mutex.unlock(); | 4816 | whole.cache_manifest_mutex.lock(); |
| 4805 | try whole_cache_manifest.addFilePost(dep_file_path); | 4817 | defer whole.cache_manifest_mutex.unlock(); |
| 4818 | try whole_cache_manifest.addFilePost(dep_file_path); | ||
| 4819 | }, | ||
| 4820 | .incremental => {}, | ||
| 4806 | } | 4821 | } |
| 4807 | } | 4822 | } |
| 4808 | 4823 | ||
| ... | @@ -6247,7 +6262,9 @@ pub fn build_crt_file( | ... | @@ -6247,7 +6262,9 @@ pub fn build_crt_file( |
| 6247 | output_mode: std.builtin.OutputMode, | 6262 | output_mode: std.builtin.OutputMode, |
| 6248 | misc_task_tag: MiscTask, | 6263 | misc_task_tag: MiscTask, |
| 6249 | prog_node: *std.Progress.Node, | 6264 | prog_node: *std.Progress.Node, |
| 6250 | c_source_files: []const CSourceFile, | 6265 | /// These elements have to get mutated to add the owner module after it is |
| 6266 | /// created within this function. | ||
| 6267 | c_source_files: []CSourceFile, | ||
| 6251 | ) !void { | 6268 | ) !void { |
| 6252 | const tracy_trace = trace(@src()); | 6269 | const tracy_trace = trace(@src()); |
| 6253 | defer tracy_trace.end(); | 6270 | defer tracy_trace.end(); |
| ... | @@ -6305,6 +6322,10 @@ pub fn build_crt_file( | ... | @@ -6305,6 +6322,10 @@ pub fn build_crt_file( |
| 6305 | .builtin_mod = null, | 6322 | .builtin_mod = null, |
| 6306 | }); | 6323 | }); |
| 6307 | 6324 | ||
| 6325 | for (c_source_files) |*item| { | ||
| 6326 | item.owner = root_mod; | ||
| 6327 | } | ||
| 6328 | |||
| 6308 | const sub_compilation = try Compilation.create(gpa, .{ | 6329 | const sub_compilation = try Compilation.create(gpa, .{ |
| 6309 | .local_cache_directory = comp.global_cache_directory, | 6330 | .local_cache_directory = comp.global_cache_directory, |
| 6310 | .global_cache_directory = comp.global_cache_directory, | 6331 | .global_cache_directory = comp.global_cache_directory, |
src/Module.zig+1-1| ... | @@ -5275,7 +5275,7 @@ pub fn populateTestFunctions( | ... | @@ -5275,7 +5275,7 @@ pub fn populateTestFunctions( |
| 5275 | ) !void { | 5275 | ) !void { |
| 5276 | const gpa = mod.gpa; | 5276 | const gpa = mod.gpa; |
| 5277 | const ip = &mod.intern_pool; | 5277 | const ip = &mod.intern_pool; |
| 5278 | const builtin_mod = mod.main_mod.deps.get("builtin").?; | 5278 | const builtin_mod = mod.main_mod.getBuiltinDependency(); |
| 5279 | const builtin_file = (mod.importPkg(builtin_mod) catch unreachable).file; | 5279 | const builtin_file = (mod.importPkg(builtin_mod) catch unreachable).file; |
| 5280 | const root_decl = mod.declPtr(builtin_file.root_decl.unwrap().?); | 5280 | const root_decl = mod.declPtr(builtin_file.root_decl.unwrap().?); |
| 5281 | const builtin_namespace = mod.namespacePtr(root_decl.src_namespace); | 5281 | const builtin_namespace = mod.namespacePtr(root_decl.src_namespace); |
src/Package/Module.zig+41-35| ... | @@ -310,7 +310,39 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { | ... | @@ -310,7 +310,39 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { |
| 310 | break :b buf.items[0 .. buf.items.len - 1 :0].ptr; | 310 | break :b buf.items[0 .. buf.items.len - 1 :0].ptr; |
| 311 | }; | 311 | }; |
| 312 | 312 | ||
| 313 | const builtin_mod = options.builtin_mod orelse b: { | 313 | const mod = try arena.create(Module); |
| 314 | mod.* = .{ | ||
| 315 | .root = options.paths.root, | ||
| 316 | .root_src_path = options.paths.root_src_path, | ||
| 317 | .fully_qualified_name = options.fully_qualified_name, | ||
| 318 | .resolved_target = .{ | ||
| 319 | .result = target, | ||
| 320 | .is_native_os = resolved_target.is_native_os, | ||
| 321 | .is_native_abi = resolved_target.is_native_abi, | ||
| 322 | .llvm_cpu_features = llvm_cpu_features, | ||
| 323 | }, | ||
| 324 | .optimize_mode = optimize_mode, | ||
| 325 | .single_threaded = single_threaded, | ||
| 326 | .error_tracing = error_tracing, | ||
| 327 | .valgrind = valgrind, | ||
| 328 | .pic = pic, | ||
| 329 | .strip = strip, | ||
| 330 | .omit_frame_pointer = omit_frame_pointer, | ||
| 331 | .stack_check = stack_check, | ||
| 332 | .stack_protector = stack_protector, | ||
| 333 | .code_model = code_model, | ||
| 334 | .red_zone = red_zone, | ||
| 335 | .sanitize_c = sanitize_c, | ||
| 336 | .sanitize_thread = sanitize_thread, | ||
| 337 | .unwind_tables = unwind_tables, | ||
| 338 | .cc_argv = options.cc_argv, | ||
| 339 | .structured_cfg = structured_cfg, | ||
| 340 | .builtin_file = null, | ||
| 341 | }; | ||
| 342 | |||
| 343 | const opt_builtin_mod = options.builtin_mod orelse b: { | ||
| 344 | if (!options.global.have_zcu) break :b null; | ||
| 345 | |||
| 314 | const generated_builtin_source = try Builtin.generate(.{ | 346 | const generated_builtin_source = try Builtin.generate(.{ |
| 315 | .target = target, | 347 | .target = target, |
| 316 | .zig_backend = zig_backend, | 348 | .zig_backend = zig_backend, |
| ... | @@ -388,38 +420,10 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { | ... | @@ -388,38 +420,10 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { |
| 388 | break :b new; | 420 | break :b new; |
| 389 | }; | 421 | }; |
| 390 | 422 | ||
| 391 | const mod = try arena.create(Module); | 423 | if (opt_builtin_mod) |builtin_mod| { |
| 392 | mod.* = .{ | 424 | try mod.deps.ensureUnusedCapacity(arena, 1); |
| 393 | .root = options.paths.root, | 425 | mod.deps.putAssumeCapacityNoClobber("builtin", builtin_mod); |
| 394 | .root_src_path = options.paths.root_src_path, | 426 | } |
| 395 | .fully_qualified_name = options.fully_qualified_name, | ||
| 396 | .resolved_target = .{ | ||
| 397 | .result = target, | ||
| 398 | .is_native_os = resolved_target.is_native_os, | ||
| 399 | .is_native_abi = resolved_target.is_native_abi, | ||
| 400 | .llvm_cpu_features = llvm_cpu_features, | ||
| 401 | }, | ||
| 402 | .optimize_mode = optimize_mode, | ||
| 403 | .single_threaded = single_threaded, | ||
| 404 | .error_tracing = error_tracing, | ||
| 405 | .valgrind = valgrind, | ||
| 406 | .pic = pic, | ||
| 407 | .strip = strip, | ||
| 408 | .omit_frame_pointer = omit_frame_pointer, | ||
| 409 | .stack_check = stack_check, | ||
| 410 | .stack_protector = stack_protector, | ||
| 411 | .code_model = code_model, | ||
| 412 | .red_zone = red_zone, | ||
| 413 | .sanitize_c = sanitize_c, | ||
| 414 | .sanitize_thread = sanitize_thread, | ||
| 415 | .unwind_tables = unwind_tables, | ||
| 416 | .cc_argv = options.cc_argv, | ||
| 417 | .structured_cfg = structured_cfg, | ||
| 418 | .builtin_file = null, | ||
| 419 | }; | ||
| 420 | |||
| 421 | try mod.deps.ensureUnusedCapacity(arena, 1); | ||
| 422 | mod.deps.putAssumeCapacityNoClobber("builtin", builtin_mod); | ||
| 423 | 427 | ||
| 424 | return mod; | 428 | return mod; |
| 425 | } | 429 | } |
| ... | @@ -462,8 +466,10 @@ pub fn createLimited(gpa: Allocator, options: LimitedOptions) Allocator.Error!*P | ... | @@ -462,8 +466,10 @@ pub fn createLimited(gpa: Allocator, options: LimitedOptions) Allocator.Error!*P |
| 462 | return mod; | 466 | return mod; |
| 463 | } | 467 | } |
| 464 | 468 | ||
| 465 | pub fn getBuiltinDependency(m: *Module) *Module { | 469 | pub fn getBuiltinDependency(m: Module) *Module { |
| 466 | return m.deps.values()[0]; | 470 | const result = m.deps.values()[0]; |
| 471 | assert(result.isBuiltin()); | ||
| 472 | return result; | ||
| 467 | } | 473 | } |
| 468 | 474 | ||
| 469 | const Module = @This(); | 475 | const Module = @This(); |
src/Sema.zig+31-6| ... | @@ -5759,14 +5759,39 @@ fn zirCImport(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -5759,14 +5759,39 @@ fn zirCImport(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileEr |
| 5759 | }; | 5759 | }; |
| 5760 | return sema.failWithOwnedErrorMsg(&child_block, msg); | 5760 | return sema.failWithOwnedErrorMsg(&child_block, msg); |
| 5761 | } | 5761 | } |
| 5762 | const c_import_mod = try Package.Module.create(comp.arena.allocator(), .{ | 5762 | const parent_mod = parent_block.ownerModule(); |
| 5763 | .root = .{ | 5763 | const c_import_mod = Package.Module.create(comp.arena.allocator(), .{ |
| 5764 | .root_dir = Compilation.Directory.cwd(), | 5764 | .global_cache_directory = comp.global_cache_directory, |
| 5765 | .sub_path = std.fs.path.dirname(c_import_res.out_zig_path) orelse "", | 5765 | .paths = .{ |
| 5766 | .root = .{ | ||
| 5767 | .root_dir = Compilation.Directory.cwd(), | ||
| 5768 | .sub_path = std.fs.path.dirname(c_import_res.out_zig_path) orelse "", | ||
| 5769 | }, | ||
| 5770 | .root_src_path = std.fs.path.basename(c_import_res.out_zig_path), | ||
| 5766 | }, | 5771 | }, |
| 5767 | .root_src_path = std.fs.path.basename(c_import_res.out_zig_path), | ||
| 5768 | .fully_qualified_name = c_import_res.out_zig_path, | 5772 | .fully_qualified_name = c_import_res.out_zig_path, |
| 5769 | }); | 5773 | .cc_argv = parent_mod.cc_argv, |
| 5774 | .inherited = .{}, | ||
| 5775 | .global = comp.config, | ||
| 5776 | .parent = parent_mod, | ||
| 5777 | .builtin_mod = parent_mod.getBuiltinDependency(), | ||
| 5778 | }) catch |err| switch (err) { | ||
| 5779 | // None of these are possible because we are creating a package with | ||
| 5780 | // the exact same configuration as the parent package, which already | ||
| 5781 | // passed these checks. | ||
| 5782 | error.ValgrindUnsupportedOnTarget => unreachable, | ||
| 5783 | error.TargetRequiresSingleThreaded => unreachable, | ||
| 5784 | error.BackendRequiresSingleThreaded => unreachable, | ||
| 5785 | error.TargetRequiresPic => unreachable, | ||
| 5786 | error.PieRequiresPic => unreachable, | ||
| 5787 | error.DynamicLinkingRequiresPic => unreachable, | ||
| 5788 | error.TargetHasNoRedZone => unreachable, | ||
| 5789 | error.StackCheckUnsupportedByTarget => unreachable, | ||
| 5790 | error.StackProtectorUnsupportedByTarget => unreachable, | ||
| 5791 | error.StackProtectorUnavailableWithoutLibC => unreachable, | ||
| 5792 | |||
| 5793 | else => |e| return e, | ||
| 5794 | }; | ||
| 5770 | 5795 | ||
| 5771 | const result = mod.importPkg(c_import_mod) catch |err| | 5796 | const result = mod.importPkg(c_import_mod) catch |err| |
| 5772 | return sema.fail(&child_block, src, "C import failed: {s}", .{@errorName(err)}); | 5797 | return sema.fail(&child_block, src, "C import failed: {s}", .{@errorName(err)}); |
src/glibc.zig+15-8| ... | @@ -170,7 +170,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -170,7 +170,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 170 | defer arena_allocator.deinit(); | 170 | defer arena_allocator.deinit(); |
| 171 | const arena = arena_allocator.allocator(); | 171 | const arena = arena_allocator.allocator(); |
| 172 | 172 | ||
| 173 | const target = comp.getTarget(); | 173 | const target = comp.root_mod.resolved_target.result; |
| 174 | const target_ver = target.os.version_range.linux.glibc; | 174 | const target_ver = target.os.version_range.linux.glibc; |
| 175 | const start_old_init_fini = target_ver.order(.{ .major = 2, .minor = 33, .patch = 0 }) != .gt; | 175 | const start_old_init_fini = target_ver.order(.{ .major = 2, .minor = 33, .patch = 0 }) != .gt; |
| 176 | 176 | ||
| ... | @@ -196,12 +196,14 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -196,12 +196,14 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 196 | "-DASSEMBLER", | 196 | "-DASSEMBLER", |
| 197 | "-Wa,--noexecstack", | 197 | "-Wa,--noexecstack", |
| 198 | }); | 198 | }); |
| 199 | return comp.build_crt_file("crti", .Obj, .@"glibc crti.o", prog_node, &.{ | 199 | var files = [_]Compilation.CSourceFile{ |
| 200 | .{ | 200 | .{ |
| 201 | .src_path = try start_asm_path(comp, arena, "crti.S"), | 201 | .src_path = try start_asm_path(comp, arena, "crti.S"), |
| 202 | .cache_exempt_flags = args.items, | 202 | .cache_exempt_flags = args.items, |
| 203 | .owner = comp.root_mod, | ||
| 203 | }, | 204 | }, |
| 204 | }); | 205 | }; |
| 206 | return comp.build_crt_file("crti", .Obj, .@"glibc crti.o", prog_node, &files); | ||
| 205 | }, | 207 | }, |
| 206 | .crtn_o => { | 208 | .crtn_o => { |
| 207 | var args = std.ArrayList([]const u8).init(arena); | 209 | var args = std.ArrayList([]const u8).init(arena); |
| ... | @@ -215,12 +217,14 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -215,12 +217,14 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 215 | "-DASSEMBLER", | 217 | "-DASSEMBLER", |
| 216 | "-Wa,--noexecstack", | 218 | "-Wa,--noexecstack", |
| 217 | }); | 219 | }); |
| 218 | return comp.build_crt_file("crtn", .Obj, .@"glibc crtn.o", prog_node, &.{ | 220 | var files = [_]Compilation.CSourceFile{ |
| 219 | .{ | 221 | .{ |
| 220 | .src_path = try start_asm_path(comp, arena, "crtn.S"), | 222 | .src_path = try start_asm_path(comp, arena, "crtn.S"), |
| 221 | .cache_exempt_flags = args.items, | 223 | .cache_exempt_flags = args.items, |
| 224 | .owner = undefined, | ||
| 222 | }, | 225 | }, |
| 223 | }); | 226 | }; |
| 227 | return comp.build_crt_file("crtn", .Obj, .@"glibc crtn.o", prog_node, &files); | ||
| 224 | }, | 228 | }, |
| 225 | .scrt1_o => { | 229 | .scrt1_o => { |
| 226 | const start_o: Compilation.CSourceFile = blk: { | 230 | const start_o: Compilation.CSourceFile = blk: { |
| ... | @@ -244,6 +248,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -244,6 +248,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 244 | break :blk .{ | 248 | break :blk .{ |
| 245 | .src_path = try start_asm_path(comp, arena, src_path), | 249 | .src_path = try start_asm_path(comp, arena, src_path), |
| 246 | .cache_exempt_flags = args.items, | 250 | .cache_exempt_flags = args.items, |
| 251 | .owner = undefined, | ||
| 247 | }; | 252 | }; |
| 248 | }; | 253 | }; |
| 249 | const abi_note_o: Compilation.CSourceFile = blk: { | 254 | const abi_note_o: Compilation.CSourceFile = blk: { |
| ... | @@ -263,11 +268,11 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -263,11 +268,11 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 263 | break :blk .{ | 268 | break :blk .{ |
| 264 | .src_path = try lib_path(comp, arena, lib_libc_glibc ++ "csu" ++ path.sep_str ++ "abi-note.S"), | 269 | .src_path = try lib_path(comp, arena, lib_libc_glibc ++ "csu" ++ path.sep_str ++ "abi-note.S"), |
| 265 | .cache_exempt_flags = args.items, | 270 | .cache_exempt_flags = args.items, |
| 271 | .owner = undefined, | ||
| 266 | }; | 272 | }; |
| 267 | }; | 273 | }; |
| 268 | return comp.build_crt_file("Scrt1", .Obj, .@"glibc Scrt1.o", prog_node, &.{ | 274 | var files = [_]Compilation.CSourceFile{ start_o, abi_note_o }; |
| 269 | start_o, abi_note_o, | 275 | return comp.build_crt_file("Scrt1", .Obj, .@"glibc Scrt1.o", prog_node, &files); |
| 270 | }); | ||
| 271 | }, | 276 | }, |
| 272 | .libc_nonshared_a => { | 277 | .libc_nonshared_a => { |
| 273 | const s = path.sep_str; | 278 | const s = path.sep_str; |
| ... | @@ -364,6 +369,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -364,6 +369,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 364 | files_buf[files_index] = .{ | 369 | files_buf[files_index] = .{ |
| 365 | .src_path = try lib_path(comp, arena, dep.path), | 370 | .src_path = try lib_path(comp, arena, dep.path), |
| 366 | .cache_exempt_flags = args.items, | 371 | .cache_exempt_flags = args.items, |
| 372 | .owner = undefined, | ||
| 367 | }; | 373 | }; |
| 368 | files_index += 1; | 374 | files_index += 1; |
| 369 | } | 375 | } |
| ... | @@ -1065,6 +1071,7 @@ fn buildSharedLib( | ... | @@ -1065,6 +1071,7 @@ fn buildSharedLib( |
| 1065 | const c_source_files = [1]Compilation.CSourceFile{ | 1071 | const c_source_files = [1]Compilation.CSourceFile{ |
| 1066 | .{ | 1072 | .{ |
| 1067 | .src_path = try path.join(arena, &[_][]const u8{ bin_directory.path.?, asm_file_basename }), | 1073 | .src_path = try path.join(arena, &[_][]const u8{ bin_directory.path.?, asm_file_basename }), |
| 1074 | .owner = undefined, | ||
| 1068 | }, | 1075 | }, |
| 1069 | }; | 1076 | }; |
| 1070 | 1077 |
src/libcxx.zig+93-89| ... | @@ -138,6 +138,50 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -138,6 +138,50 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 138 | const abi_namespace_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{ | 138 | const abi_namespace_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{ |
| 139 | @intFromEnum(comp.libcxx_abi_version), | 139 | @intFromEnum(comp.libcxx_abi_version), |
| 140 | }); | 140 | }); |
| 141 | |||
| 142 | const optimize_mode = comp.compilerRtOptMode(); | ||
| 143 | const strip = comp.compilerRtStrip(); | ||
| 144 | |||
| 145 | const config = try Compilation.Config.resolve(.{ | ||
| 146 | .output_mode = output_mode, | ||
| 147 | .link_mode = link_mode, | ||
| 148 | .resolved_target = comp.root_mod.resolved_target, | ||
| 149 | .is_test = false, | ||
| 150 | .have_zcu = false, | ||
| 151 | .emit_bin = true, | ||
| 152 | .root_optimize_mode = optimize_mode, | ||
| 153 | .root_strip = strip, | ||
| 154 | .link_libc = true, | ||
| 155 | .lto = comp.config.lto, | ||
| 156 | }); | ||
| 157 | |||
| 158 | const root_mod = try Module.create(arena, .{ | ||
| 159 | .global_cache_directory = comp.global_cache_directory, | ||
| 160 | .paths = .{ | ||
| 161 | .root = .{ .root_dir = comp.zig_lib_directory }, | ||
| 162 | .root_src_path = "", | ||
| 163 | }, | ||
| 164 | .fully_qualified_name = "root", | ||
| 165 | .inherited = .{ | ||
| 166 | .resolved_target = comp.root_mod.resolved_target, | ||
| 167 | .strip = strip, | ||
| 168 | .stack_check = false, | ||
| 169 | .stack_protector = 0, | ||
| 170 | .sanitize_c = false, | ||
| 171 | .sanitize_thread = comp.config.any_sanitize_thread, | ||
| 172 | .red_zone = comp.root_mod.red_zone, | ||
| 173 | .omit_frame_pointer = comp.root_mod.omit_frame_pointer, | ||
| 174 | .valgrind = false, | ||
| 175 | .optimize_mode = optimize_mode, | ||
| 176 | .structured_cfg = comp.root_mod.structured_cfg, | ||
| 177 | .pic = comp.root_mod.pic, | ||
| 178 | }, | ||
| 179 | .global = config, | ||
| 180 | .cc_argv = &.{}, | ||
| 181 | .parent = null, | ||
| 182 | .builtin_mod = null, | ||
| 183 | }); | ||
| 184 | |||
| 141 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxx_files.len); | 185 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxx_files.len); |
| 142 | 186 | ||
| 143 | for (libcxx_files) |cxx_src| { | 187 | for (libcxx_files) |cxx_src| { |
| ... | @@ -224,52 +268,10 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -224,52 +268,10 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 224 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", cxx_src }), | 268 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", cxx_src }), |
| 225 | .extra_flags = cflags.items, | 269 | .extra_flags = cflags.items, |
| 226 | .cache_exempt_flags = cache_exempt_flags.items, | 270 | .cache_exempt_flags = cache_exempt_flags.items, |
| 271 | .owner = root_mod, | ||
| 227 | }); | 272 | }); |
| 228 | } | 273 | } |
| 229 | 274 | ||
| 230 | const optimize_mode = comp.compilerRtOptMode(); | ||
| 231 | const strip = comp.compilerRtStrip(); | ||
| 232 | |||
| 233 | const config = try Compilation.Config.resolve(.{ | ||
| 234 | .output_mode = output_mode, | ||
| 235 | .link_mode = link_mode, | ||
| 236 | .resolved_target = comp.root_mod.resolved_target, | ||
| 237 | .is_test = false, | ||
| 238 | .have_zcu = false, | ||
| 239 | .emit_bin = true, | ||
| 240 | .root_optimize_mode = optimize_mode, | ||
| 241 | .root_strip = strip, | ||
| 242 | .link_libc = true, | ||
| 243 | .lto = comp.config.lto, | ||
| 244 | }); | ||
| 245 | |||
| 246 | const root_mod = try Module.create(arena, .{ | ||
| 247 | .global_cache_directory = comp.global_cache_directory, | ||
| 248 | .paths = .{ | ||
| 249 | .root = .{ .root_dir = comp.zig_lib_directory }, | ||
| 250 | .root_src_path = "", | ||
| 251 | }, | ||
| 252 | .fully_qualified_name = "root", | ||
| 253 | .inherited = .{ | ||
| 254 | .resolved_target = comp.root_mod.resolved_target, | ||
| 255 | .strip = strip, | ||
| 256 | .stack_check = false, | ||
| 257 | .stack_protector = 0, | ||
| 258 | .sanitize_c = false, | ||
| 259 | .sanitize_thread = comp.config.any_sanitize_thread, | ||
| 260 | .red_zone = comp.root_mod.red_zone, | ||
| 261 | .omit_frame_pointer = comp.root_mod.omit_frame_pointer, | ||
| 262 | .valgrind = false, | ||
| 263 | .optimize_mode = optimize_mode, | ||
| 264 | .structured_cfg = comp.root_mod.structured_cfg, | ||
| 265 | .pic = comp.root_mod.pic, | ||
| 266 | }, | ||
| 267 | .global = config, | ||
| 268 | .cc_argv = &.{}, | ||
| 269 | .parent = null, | ||
| 270 | .builtin_mod = null, | ||
| 271 | }); | ||
| 272 | |||
| 273 | const sub_compilation = try Compilation.create(comp.gpa, .{ | 275 | const sub_compilation = try Compilation.create(comp.gpa, .{ |
| 274 | .local_cache_directory = comp.global_cache_directory, | 276 | .local_cache_directory = comp.global_cache_directory, |
| 275 | .global_cache_directory = comp.global_cache_directory, | 277 | .global_cache_directory = comp.global_cache_directory, |
| ... | @@ -339,6 +341,53 @@ pub fn buildLibCXXABI(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -339,6 +341,53 @@ pub fn buildLibCXXABI(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 339 | const abi_namespace_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{ | 341 | const abi_namespace_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{ |
| 340 | @intFromEnum(comp.libcxx_abi_version), | 342 | @intFromEnum(comp.libcxx_abi_version), |
| 341 | }); | 343 | }); |
| 344 | |||
| 345 | const optimize_mode = comp.compilerRtOptMode(); | ||
| 346 | const strip = comp.compilerRtStrip(); | ||
| 347 | const unwind_tables = true; | ||
| 348 | |||
| 349 | const config = try Compilation.Config.resolve(.{ | ||
| 350 | .output_mode = output_mode, | ||
| 351 | .link_mode = link_mode, | ||
| 352 | .resolved_target = comp.root_mod.resolved_target, | ||
| 353 | .is_test = false, | ||
| 354 | .have_zcu = false, | ||
| 355 | .emit_bin = true, | ||
| 356 | .root_optimize_mode = optimize_mode, | ||
| 357 | .root_strip = strip, | ||
| 358 | .link_libc = true, | ||
| 359 | .any_unwind_tables = unwind_tables, | ||
| 360 | .lto = comp.config.lto, | ||
| 361 | }); | ||
| 362 | |||
| 363 | const root_mod = try Module.create(arena, .{ | ||
| 364 | .global_cache_directory = comp.global_cache_directory, | ||
| 365 | .paths = .{ | ||
| 366 | .root = .{ .root_dir = comp.zig_lib_directory }, | ||
| 367 | .root_src_path = "", | ||
| 368 | }, | ||
| 369 | .fully_qualified_name = "root", | ||
| 370 | .inherited = .{ | ||
| 371 | .resolved_target = comp.root_mod.resolved_target, | ||
| 372 | .strip = strip, | ||
| 373 | .stack_check = false, | ||
| 374 | .stack_protector = 0, | ||
| 375 | .sanitize_c = false, | ||
| 376 | .sanitize_thread = comp.config.any_sanitize_thread, | ||
| 377 | .red_zone = comp.root_mod.red_zone, | ||
| 378 | .omit_frame_pointer = comp.root_mod.omit_frame_pointer, | ||
| 379 | .valgrind = false, | ||
| 380 | .optimize_mode = optimize_mode, | ||
| 381 | .structured_cfg = comp.root_mod.structured_cfg, | ||
| 382 | .unwind_tables = unwind_tables, | ||
| 383 | .pic = comp.root_mod.pic, | ||
| 384 | }, | ||
| 385 | .global = config, | ||
| 386 | .cc_argv = &.{}, | ||
| 387 | .parent = null, | ||
| 388 | .builtin_mod = null, | ||
| 389 | }); | ||
| 390 | |||
| 342 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxxabi_files.len); | 391 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxxabi_files.len); |
| 343 | 392 | ||
| 344 | for (libcxxabi_files) |cxxabi_src| { | 393 | for (libcxxabi_files) |cxxabi_src| { |
| ... | @@ -406,55 +455,10 @@ pub fn buildLibCXXABI(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -406,55 +455,10 @@ pub fn buildLibCXXABI(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 406 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxxabi", cxxabi_src }), | 455 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxxabi", cxxabi_src }), |
| 407 | .extra_flags = cflags.items, | 456 | .extra_flags = cflags.items, |
| 408 | .cache_exempt_flags = cache_exempt_flags.items, | 457 | .cache_exempt_flags = cache_exempt_flags.items, |
| 458 | .owner = root_mod, | ||
| 409 | }); | 459 | }); |
| 410 | } | 460 | } |
| 411 | 461 | ||
| 412 | const optimize_mode = comp.compilerRtOptMode(); | ||
| 413 | const strip = comp.compilerRtStrip(); | ||
| 414 | const unwind_tables = true; | ||
| 415 | |||
| 416 | const config = try Compilation.Config.resolve(.{ | ||
| 417 | .output_mode = output_mode, | ||
| 418 | .link_mode = link_mode, | ||
| 419 | .resolved_target = comp.root_mod.resolved_target, | ||
| 420 | .is_test = false, | ||
| 421 | .have_zcu = false, | ||
| 422 | .emit_bin = true, | ||
| 423 | .root_optimize_mode = optimize_mode, | ||
| 424 | .root_strip = strip, | ||
| 425 | .link_libc = true, | ||
| 426 | .any_unwind_tables = unwind_tables, | ||
| 427 | .lto = comp.config.lto, | ||
| 428 | }); | ||
| 429 | |||
| 430 | const root_mod = try Module.create(arena, .{ | ||
| 431 | .global_cache_directory = comp.global_cache_directory, | ||
| 432 | .paths = .{ | ||
| 433 | .root = .{ .root_dir = comp.zig_lib_directory }, | ||
| 434 | .root_src_path = "", | ||
| 435 | }, | ||
| 436 | .fully_qualified_name = "root", | ||
| 437 | .inherited = .{ | ||
| 438 | .resolved_target = comp.root_mod.resolved_target, | ||
| 439 | .strip = strip, | ||
| 440 | .stack_check = false, | ||
| 441 | .stack_protector = 0, | ||
| 442 | .sanitize_c = false, | ||
| 443 | .sanitize_thread = comp.config.any_sanitize_thread, | ||
| 444 | .red_zone = comp.root_mod.red_zone, | ||
| 445 | .omit_frame_pointer = comp.root_mod.omit_frame_pointer, | ||
| 446 | .valgrind = false, | ||
| 447 | .optimize_mode = optimize_mode, | ||
| 448 | .structured_cfg = comp.root_mod.structured_cfg, | ||
| 449 | .unwind_tables = unwind_tables, | ||
| 450 | .pic = comp.root_mod.pic, | ||
| 451 | }, | ||
| 452 | .global = config, | ||
| 453 | .cc_argv = &.{}, | ||
| 454 | .parent = null, | ||
| 455 | .builtin_mod = null, | ||
| 456 | }); | ||
| 457 | |||
| 458 | const sub_compilation = try Compilation.create(comp.gpa, .{ | 462 | const sub_compilation = try Compilation.create(comp.gpa, .{ |
| 459 | .local_cache_directory = comp.global_cache_directory, | 463 | .local_cache_directory = comp.global_cache_directory, |
| 460 | .global_cache_directory = comp.global_cache_directory, | 464 | .global_cache_directory = comp.global_cache_directory, |
src/libtsan.zig+54-48| ... | @@ -34,6 +34,52 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -34,6 +34,52 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 34 | .basename = basename, | 34 | .basename = basename, |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | const optimize_mode = comp.compilerRtOptMode(); | ||
| 38 | const strip = comp.compilerRtStrip(); | ||
| 39 | |||
| 40 | const config = try Compilation.Config.resolve(.{ | ||
| 41 | .output_mode = output_mode, | ||
| 42 | .link_mode = link_mode, | ||
| 43 | .resolved_target = comp.root_mod.resolved_target, | ||
| 44 | .is_test = false, | ||
| 45 | .have_zcu = false, | ||
| 46 | .emit_bin = true, | ||
| 47 | .root_optimize_mode = optimize_mode, | ||
| 48 | .root_strip = strip, | ||
| 49 | .link_libc = true, | ||
| 50 | }); | ||
| 51 | |||
| 52 | const common_flags = [_][]const u8{ | ||
| 53 | "-DTSAN_CONTAINS_UBSAN=0", | ||
| 54 | }; | ||
| 55 | |||
| 56 | const root_mod = try Module.create(arena, .{ | ||
| 57 | .global_cache_directory = comp.global_cache_directory, | ||
| 58 | .paths = .{ | ||
| 59 | .root = .{ .root_dir = comp.zig_lib_directory }, | ||
| 60 | .root_src_path = "", | ||
| 61 | }, | ||
| 62 | .fully_qualified_name = "root", | ||
| 63 | .inherited = .{ | ||
| 64 | .resolved_target = comp.root_mod.resolved_target, | ||
| 65 | .strip = strip, | ||
| 66 | .stack_check = false, | ||
| 67 | .stack_protector = 0, | ||
| 68 | .sanitize_c = false, | ||
| 69 | .sanitize_thread = false, | ||
| 70 | .red_zone = comp.root_mod.red_zone, | ||
| 71 | .omit_frame_pointer = comp.root_mod.omit_frame_pointer, | ||
| 72 | .valgrind = false, | ||
| 73 | .optimize_mode = optimize_mode, | ||
| 74 | .structured_cfg = comp.root_mod.structured_cfg, | ||
| 75 | .pic = true, | ||
| 76 | }, | ||
| 77 | .global = config, | ||
| 78 | .cc_argv = &common_flags, | ||
| 79 | .parent = null, | ||
| 80 | .builtin_mod = null, | ||
| 81 | }); | ||
| 82 | |||
| 37 | var c_source_files = std.ArrayList(Compilation.CSourceFile).init(arena); | 83 | var c_source_files = std.ArrayList(Compilation.CSourceFile).init(arena); |
| 38 | try c_source_files.ensureUnusedCapacity(tsan_sources.len); | 84 | try c_source_files.ensureUnusedCapacity(tsan_sources.len); |
| 39 | 85 | ||
| ... | @@ -50,8 +96,9 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -50,8 +96,9 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 50 | try cflags.append("-fno-rtti"); | 96 | try cflags.append("-fno-rtti"); |
| 51 | 97 | ||
| 52 | c_source_files.appendAssumeCapacity(.{ | 98 | c_source_files.appendAssumeCapacity(.{ |
| 53 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "tsan", tsan_src }), | 99 | .src_path = try comp.zig_lib_directory.join(arena, &.{ "tsan", tsan_src }), |
| 54 | .extra_flags = cflags.items, | 100 | .extra_flags = cflags.items, |
| 101 | .owner = root_mod, | ||
| 55 | }); | 102 | }); |
| 56 | } | 103 | } |
| 57 | 104 | ||
| ... | @@ -74,6 +121,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -74,6 +121,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 74 | c_source_files.appendAssumeCapacity(.{ | 121 | c_source_files.appendAssumeCapacity(.{ |
| 75 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "tsan", tsan_src }), | 122 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "tsan", tsan_src }), |
| 76 | .extra_flags = cflags.items, | 123 | .extra_flags = cflags.items, |
| 124 | .owner = root_mod, | ||
| 77 | }); | 125 | }); |
| 78 | } | 126 | } |
| 79 | { | 127 | { |
| ... | @@ -94,6 +142,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -94,6 +142,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 94 | c_source_files.appendAssumeCapacity(.{ | 142 | c_source_files.appendAssumeCapacity(.{ |
| 95 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "tsan", asm_source }), | 143 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "tsan", asm_source }), |
| 96 | .extra_flags = cflags.items, | 144 | .extra_flags = cflags.items, |
| 145 | .owner = root_mod, | ||
| 97 | }); | 146 | }); |
| 98 | } | 147 | } |
| 99 | 148 | ||
| ... | @@ -117,6 +166,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -117,6 +166,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 117 | "tsan", "sanitizer_common", common_src, | 166 | "tsan", "sanitizer_common", common_src, |
| 118 | }), | 167 | }), |
| 119 | .extra_flags = cflags.items, | 168 | .extra_flags = cflags.items, |
| 169 | .owner = root_mod, | ||
| 120 | }); | 170 | }); |
| 121 | } | 171 | } |
| 122 | 172 | ||
| ... | @@ -141,6 +191,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -141,6 +191,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 141 | "tsan", "sanitizer_common", c_src, | 191 | "tsan", "sanitizer_common", c_src, |
| 142 | }), | 192 | }), |
| 143 | .extra_flags = cflags.items, | 193 | .extra_flags = cflags.items, |
| 194 | .owner = root_mod, | ||
| 144 | }); | 195 | }); |
| 145 | } | 196 | } |
| 146 | 197 | ||
| ... | @@ -161,6 +212,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -161,6 +212,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 161 | "tsan", "sanitizer_common", c_src, | 212 | "tsan", "sanitizer_common", c_src, |
| 162 | }), | 213 | }), |
| 163 | .extra_flags = cflags.items, | 214 | .extra_flags = cflags.items, |
| 215 | .owner = root_mod, | ||
| 164 | }); | 216 | }); |
| 165 | } | 217 | } |
| 166 | 218 | ||
| ... | @@ -189,56 +241,10 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -189,56 +241,10 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 189 | "tsan", "interception", c_src, | 241 | "tsan", "interception", c_src, |
| 190 | }), | 242 | }), |
| 191 | .extra_flags = cflags.items, | 243 | .extra_flags = cflags.items, |
| 244 | .owner = root_mod, | ||
| 192 | }); | 245 | }); |
| 193 | } | 246 | } |
| 194 | 247 | ||
| 195 | const common_flags = [_][]const u8{ | ||
| 196 | "-DTSAN_CONTAINS_UBSAN=0", | ||
| 197 | }; | ||
| 198 | |||
| 199 | const optimize_mode = comp.compilerRtOptMode(); | ||
| 200 | const strip = comp.compilerRtStrip(); | ||
| 201 | |||
| 202 | const config = try Compilation.Config.resolve(.{ | ||
| 203 | .output_mode = output_mode, | ||
| 204 | .link_mode = link_mode, | ||
| 205 | .resolved_target = comp.root_mod.resolved_target, | ||
| 206 | .is_test = false, | ||
| 207 | .have_zcu = false, | ||
| 208 | .emit_bin = true, | ||
| 209 | .root_optimize_mode = optimize_mode, | ||
| 210 | .root_strip = strip, | ||
| 211 | .link_libc = true, | ||
| 212 | }); | ||
| 213 | |||
| 214 | const root_mod = try Module.create(arena, .{ | ||
| 215 | .global_cache_directory = comp.global_cache_directory, | ||
| 216 | .paths = .{ | ||
| 217 | .root = .{ .root_dir = comp.zig_lib_directory }, | ||
| 218 | .root_src_path = "", | ||
| 219 | }, | ||
| 220 | .fully_qualified_name = "root", | ||
| 221 | .inherited = .{ | ||
| 222 | .resolved_target = comp.root_mod.resolved_target, | ||
| 223 | .strip = strip, | ||
| 224 | .stack_check = false, | ||
| 225 | .stack_protector = 0, | ||
| 226 | .sanitize_c = false, | ||
| 227 | .sanitize_thread = false, | ||
| 228 | .red_zone = comp.root_mod.red_zone, | ||
| 229 | .omit_frame_pointer = comp.root_mod.omit_frame_pointer, | ||
| 230 | .valgrind = false, | ||
| 231 | .optimize_mode = optimize_mode, | ||
| 232 | .structured_cfg = comp.root_mod.structured_cfg, | ||
| 233 | .pic = true, | ||
| 234 | .cc_argv = &common_flags, | ||
| 235 | }, | ||
| 236 | .global = config, | ||
| 237 | .cc_argv = &.{}, | ||
| 238 | .parent = null, | ||
| 239 | .builtin_mod = null, | ||
| 240 | }); | ||
| 241 | |||
| 242 | const sub_compilation = try Compilation.create(comp.gpa, .{ | 248 | const sub_compilation = try Compilation.create(comp.gpa, .{ |
| 243 | .local_cache_directory = comp.global_cache_directory, | 249 | .local_cache_directory = comp.global_cache_directory, |
| 244 | .global_cache_directory = comp.global_cache_directory, | 250 | .global_cache_directory = comp.global_cache_directory, |
src/libunwind.zig+6-4| ... | @@ -33,7 +33,8 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -33,7 +33,8 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 33 | // Disable LTO to avoid https://github.com/llvm/llvm-project/issues/56825 | 33 | // Disable LTO to avoid https://github.com/llvm/llvm-project/issues/56825 |
| 34 | .lto = false, | 34 | .lto = false, |
| 35 | }); | 35 | }); |
| 36 | const root_mod = Module.create(.{ | 36 | const root_mod = try Module.create(arena, .{ |
| 37 | .global_cache_directory = comp.global_cache_directory, | ||
| 37 | .paths = .{ | 38 | .paths = .{ |
| 38 | .root = .{ .root_dir = comp.zig_lib_directory }, | 39 | .root = .{ .root_dir = comp.zig_lib_directory }, |
| 39 | .root_src_path = "", | 40 | .root_src_path = "", |
| ... | @@ -55,6 +56,8 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -55,6 +56,8 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 55 | }, | 56 | }, |
| 56 | .global = config, | 57 | .global = config, |
| 57 | .cc_argv = &.{}, | 58 | .cc_argv = &.{}, |
| 59 | .parent = null, | ||
| 60 | .builtin_mod = null, | ||
| 58 | }); | 61 | }); |
| 59 | 62 | ||
| 60 | const root_name = "unwind"; | 63 | const root_name = "unwind"; |
| ... | @@ -117,6 +120,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -117,6 +120,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 117 | c_source_files[i] = .{ | 120 | c_source_files[i] = .{ |
| 118 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{unwind_src}), | 121 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{unwind_src}), |
| 119 | .extra_flags = cflags.items, | 122 | .extra_flags = cflags.items, |
| 123 | .owner = root_mod, | ||
| 120 | }; | 124 | }; |
| 121 | } | 125 | } |
| 122 | const sub_compilation = try Compilation.create(comp.gpa, .{ | 126 | const sub_compilation = try Compilation.create(comp.gpa, .{ |
| ... | @@ -132,7 +136,6 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -132,7 +136,6 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 132 | .thread_pool = comp.thread_pool, | 136 | .thread_pool = comp.thread_pool, |
| 133 | .libc_installation = comp.libc_installation, | 137 | .libc_installation = comp.libc_installation, |
| 134 | .emit_bin = emit_bin, | 138 | .emit_bin = emit_bin, |
| 135 | .link_mode = link_mode, | ||
| 136 | .function_sections = comp.function_sections, | 139 | .function_sections = comp.function_sections, |
| 137 | .c_source_files = &c_source_files, | 140 | .c_source_files = &c_source_files, |
| 138 | .verbose_cc = comp.verbose_cc, | 141 | .verbose_cc = comp.verbose_cc, |
| ... | @@ -150,8 +153,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -150,8 +153,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 150 | try comp.updateSubCompilation(sub_compilation, .libunwind, prog_node); | 153 | try comp.updateSubCompilation(sub_compilation, .libunwind, prog_node); |
| 151 | 154 | ||
| 152 | assert(comp.libunwind_static_lib == null); | 155 | assert(comp.libunwind_static_lib == null); |
| 153 | 156 | comp.libunwind_static_lib = try sub_compilation.toCrtFile(); | |
| 154 | comp.libunwind_static_lib = try sub_compilation.toOwnedLock(); | ||
| 155 | } | 157 | } |
| 156 | 158 | ||
| 157 | const unwind_src_list = [_][]const u8{ | 159 | const unwind_src_list = [_][]const u8{ |
src/link/Coff.zig+4| ... | @@ -18,6 +18,8 @@ major_subsystem_version: u16, | ... | @@ -18,6 +18,8 @@ major_subsystem_version: u16, |
| 18 | minor_subsystem_version: u16, | 18 | minor_subsystem_version: u16, |
| 19 | lib_dirs: []const []const u8, | 19 | lib_dirs: []const []const u8, |
| 20 | entry_addr: ?u32, | 20 | entry_addr: ?u32, |
| 21 | module_definition_file: ?[]const u8, | ||
| 22 | pdb_out_path: ?[]const u8, | ||
| 21 | 23 | ||
| 22 | ptr_width: PtrWidth, | 24 | ptr_width: PtrWidth, |
| 23 | page_size: u32, | 25 | page_size: u32, |
| ... | @@ -425,6 +427,8 @@ pub fn createEmpty( | ... | @@ -425,6 +427,8 @@ pub fn createEmpty( |
| 425 | .lib_dirs = options.lib_dirs, | 427 | .lib_dirs = options.lib_dirs, |
| 426 | .entry_addr = math.cast(u32, options.entry_addr orelse 0) orelse | 428 | .entry_addr = math.cast(u32, options.entry_addr orelse 0) orelse |
| 427 | return error.EntryAddressTooBig, | 429 | return error.EntryAddressTooBig, |
| 430 | .module_definition_file = options.module_definition_file, | ||
| 431 | .pdb_out_path = options.pdb_out_path, | ||
| 428 | }; | 432 | }; |
| 429 | 433 | ||
| 430 | const use_llvm = comp.config.use_llvm; | 434 | const use_llvm = comp.config.use_llvm; |
src/link/Coff/lld.zig+8-15| ... | @@ -82,7 +82,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod | ... | @@ -82,7 +82,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod |
| 82 | try man.addOptionalFile(module_obj_path); | 82 | try man.addOptionalFile(module_obj_path); |
| 83 | man.hash.addOptionalBytes(comp.config.entry); | 83 | man.hash.addOptionalBytes(comp.config.entry); |
| 84 | man.hash.add(self.base.stack_size); | 84 | man.hash.add(self.base.stack_size); |
| 85 | man.hash.addOptional(self.image_base); | 85 | man.hash.add(self.image_base); |
| 86 | man.hash.addListOfBytes(self.lib_dirs); | 86 | man.hash.addListOfBytes(self.lib_dirs); |
| 87 | man.hash.add(comp.skip_linker_dependencies); | 87 | man.hash.add(comp.skip_linker_dependencies); |
| 88 | if (comp.config.link_libc) { | 88 | if (comp.config.link_libc) { |
| ... | @@ -102,10 +102,10 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod | ... | @@ -102,10 +102,10 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod |
| 102 | man.hash.add(self.tsaware); | 102 | man.hash.add(self.tsaware); |
| 103 | man.hash.add(self.nxcompat); | 103 | man.hash.add(self.nxcompat); |
| 104 | man.hash.add(self.dynamicbase); | 104 | man.hash.add(self.dynamicbase); |
| 105 | man.hash.addOptional(self.base.allow_shlib_undefined); | 105 | man.hash.add(self.base.allow_shlib_undefined); |
| 106 | // strip does not need to go into the linker hash because it is part of the hash namespace | 106 | // strip does not need to go into the linker hash because it is part of the hash namespace |
| 107 | man.hash.addOptional(self.major_subsystem_version); | 107 | man.hash.add(self.major_subsystem_version); |
| 108 | man.hash.addOptional(self.minor_subsystem_version); | 108 | man.hash.add(self.minor_subsystem_version); |
| 109 | man.hash.addOptional(comp.version); | 109 | man.hash.addOptional(comp.version); |
| 110 | try man.addOptionalFile(self.module_definition_file); | 110 | try man.addOptionalFile(self.module_definition_file); |
| 111 | 111 | ||
| ... | @@ -237,7 +237,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod | ... | @@ -237,7 +237,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod |
| 237 | 237 | ||
| 238 | try argv.append(try allocPrint(arena, "-OUT:{s}", .{full_out_path})); | 238 | try argv.append(try allocPrint(arena, "-OUT:{s}", .{full_out_path})); |
| 239 | 239 | ||
| 240 | if (self.implib_emit) |emit| { | 240 | if (comp.implib_emit) |emit| { |
| 241 | const implib_out_path = try emit.directory.join(arena, &[_][]const u8{emit.sub_path}); | 241 | const implib_out_path = try emit.directory.join(arena, &[_][]const u8{emit.sub_path}); |
| 242 | try argv.append(try allocPrint(arena, "-IMPLIB:{s}", .{implib_out_path})); | 242 | try argv.append(try allocPrint(arena, "-IMPLIB:{s}", .{implib_out_path})); |
| 243 | } | 243 | } |
| ... | @@ -310,16 +310,9 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod | ... | @@ -310,16 +310,9 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod |
| 310 | const Mode = enum { uefi, win32 }; | 310 | const Mode = enum { uefi, win32 }; |
| 311 | const mode: Mode = mode: { | 311 | const mode: Mode = mode: { |
| 312 | if (resolved_subsystem) |subsystem| { | 312 | if (resolved_subsystem) |subsystem| { |
| 313 | const subsystem_suffix = ss: { | 313 | const subsystem_suffix = try allocPrint(arena, ",{d}.{d}", .{ |
| 314 | if (self.major_subsystem_version) |major| { | 314 | self.major_subsystem_version, self.minor_subsystem_version, |
| 315 | if (self.minor_subsystem_version) |minor| { | 315 | }); |
| 316 | break :ss try allocPrint(arena, ",{d}.{d}", .{ major, minor }); | ||
| 317 | } else { | ||
| 318 | break :ss try allocPrint(arena, ",{d}", .{major}); | ||
| 319 | } | ||
| 320 | } | ||
| 321 | break :ss ""; | ||
| 322 | }; | ||
| 323 | 316 | ||
| 324 | switch (subsystem) { | 317 | switch (subsystem) { |
| 325 | .Console => { | 318 | .Console => { |
src/link/Elf.zig+11-9| ... | @@ -23,6 +23,8 @@ soname: ?[]const u8, | ... | @@ -23,6 +23,8 @@ soname: ?[]const u8, |
| 23 | bind_global_refs_locally: bool, | 23 | bind_global_refs_locally: bool, |
| 24 | linker_script: ?[]const u8, | 24 | linker_script: ?[]const u8, |
| 25 | version_script: ?[]const u8, | 25 | version_script: ?[]const u8, |
| 26 | print_icf_sections: bool, | ||
| 27 | print_map: bool, | ||
| 26 | 28 | ||
| 27 | ptr_width: PtrWidth, | 29 | ptr_width: PtrWidth, |
| 28 | 30 | ||
| ... | @@ -307,6 +309,8 @@ pub fn createEmpty( | ... | @@ -307,6 +309,8 @@ pub fn createEmpty( |
| 307 | .bind_global_refs_locally = options.bind_global_refs_locally, | 309 | .bind_global_refs_locally = options.bind_global_refs_locally, |
| 308 | .linker_script = options.linker_script, | 310 | .linker_script = options.linker_script, |
| 309 | .version_script = options.version_script, | 311 | .version_script = options.version_script, |
| 312 | .print_icf_sections = options.print_icf_sections, | ||
| 313 | .print_map = options.print_map, | ||
| 310 | }; | 314 | }; |
| 311 | if (use_llvm and comp.config.have_zcu) { | 315 | if (use_llvm and comp.config.have_zcu) { |
| 312 | self.llvm_object = try LlvmObject.create(arena, comp); | 316 | self.llvm_object = try LlvmObject.create(arena, comp); |
| ... | @@ -1294,12 +1298,9 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node | ... | @@ -1294,12 +1298,9 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node |
| 1294 | 1298 | ||
| 1295 | // Look for entry address in objects if not set by the incremental compiler. | 1299 | // Look for entry address in objects if not set by the incremental compiler. |
| 1296 | if (self.entry_index == null) { | 1300 | if (self.entry_index == null) { |
| 1297 | const entry: ?[]const u8 = entry: { | 1301 | if (comp.config.entry) |name| { |
| 1298 | if (comp.config.entry) |entry| break :entry entry; | 1302 | self.entry_index = self.globalByName(name); |
| 1299 | if (!self.base.isDynLib()) break :entry "_start"; | 1303 | } |
| 1300 | break :entry null; | ||
| 1301 | }; | ||
| 1302 | self.entry_index = if (entry) |name| self.globalByName(name) else null; | ||
| 1303 | } | 1304 | } |
| 1304 | 1305 | ||
| 1305 | if (self.base.gc_sections) { | 1306 | if (self.base.gc_sections) { |
| ... | @@ -2420,7 +2421,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v | ... | @@ -2420,7 +2421,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v |
| 2420 | // We can skip hashing libc and libc++ components that we are in charge of building from Zig | 2421 | // We can skip hashing libc and libc++ components that we are in charge of building from Zig |
| 2421 | // installation sources because they are always a product of the compiler version + target information. | 2422 | // installation sources because they are always a product of the compiler version + target information. |
| 2422 | man.hash.addOptionalBytes(comp.config.entry); | 2423 | man.hash.addOptionalBytes(comp.config.entry); |
| 2423 | man.hash.addOptional(self.image_base); | 2424 | man.hash.add(self.image_base); |
| 2424 | man.hash.add(self.base.gc_sections); | 2425 | man.hash.add(self.base.gc_sections); |
| 2425 | man.hash.addOptional(self.sort_section); | 2426 | man.hash.addOptional(self.sort_section); |
| 2426 | man.hash.add(self.eh_frame_hdr); | 2427 | man.hash.add(self.eh_frame_hdr); |
| ... | @@ -5896,7 +5897,7 @@ pub fn addSymbol(self: *Elf) !Symbol.Index { | ... | @@ -5896,7 +5897,7 @@ pub fn addSymbol(self: *Elf) !Symbol.Index { |
| 5896 | break :blk index; | 5897 | break :blk index; |
| 5897 | } else { | 5898 | } else { |
| 5898 | log.debug(" (allocating symbol index {d})", .{self.symbols.items.len}); | 5899 | log.debug(" (allocating symbol index {d})", .{self.symbols.items.len}); |
| 5899 | const index = @as(Symbol.Index, @intCast(self.symbols.items.len)); | 5900 | const index: Symbol.Index = @intCast(self.symbols.items.len); |
| 5900 | _ = self.symbols.addOneAssumeCapacity(); | 5901 | _ = self.symbols.addOneAssumeCapacity(); |
| 5901 | break :blk index; | 5902 | break :blk index; |
| 5902 | } | 5903 | } |
| ... | @@ -5961,6 +5962,7 @@ pub fn getOrPutGlobal(self: *Elf, name: []const u8) !GetOrPutGlobalResult { | ... | @@ -5961,6 +5962,7 @@ pub fn getOrPutGlobal(self: *Elf, name: []const u8) !GetOrPutGlobalResult { |
| 5961 | const gop = try self.resolver.getOrPut(gpa, name_off); | 5962 | const gop = try self.resolver.getOrPut(gpa, name_off); |
| 5962 | if (!gop.found_existing) { | 5963 | if (!gop.found_existing) { |
| 5963 | const index = try self.addSymbol(); | 5964 | const index = try self.addSymbol(); |
| 5965 | log.debug("added symbol '{s}' at index {d}", .{ name, index }); | ||
| 5964 | const global = self.symbol(index); | 5966 | const global = self.symbol(index); |
| 5965 | global.name_offset = name_off; | 5967 | global.name_offset = name_off; |
| 5966 | global.flags.global = true; | 5968 | global.flags.global = true; |
| ... | @@ -5996,7 +5998,7 @@ pub fn getOrCreateComdatGroupOwner(self: *Elf, name: [:0]const u8) !GetOrCreateC | ... | @@ -5996,7 +5998,7 @@ pub fn getOrCreateComdatGroupOwner(self: *Elf, name: [:0]const u8) !GetOrCreateC |
| 5996 | const off = try self.strings.insert(gpa, name); | 5998 | const off = try self.strings.insert(gpa, name); |
| 5997 | const gop = try self.comdat_groups_table.getOrPut(gpa, off); | 5999 | const gop = try self.comdat_groups_table.getOrPut(gpa, off); |
| 5998 | if (!gop.found_existing) { | 6000 | if (!gop.found_existing) { |
| 5999 | const index = @as(ComdatGroupOwner.Index, @intCast(self.comdat_groups_owners.items.len)); | 6001 | const index: ComdatGroupOwner.Index = @intCast(self.comdat_groups_owners.items.len); |
| 6000 | const owner = try self.comdat_groups_owners.addOne(gpa); | 6002 | const owner = try self.comdat_groups_owners.addOne(gpa); |
| 6001 | owner.* = .{}; | 6003 | owner.* = .{}; |
| 6002 | gop.value_ptr.* = index; | 6004 | gop.value_ptr.* = index; |
src/main.zig+1-1| ... | @@ -3481,7 +3481,7 @@ fn buildOutputType( | ... | @@ -3481,7 +3481,7 @@ fn buildOutputType( |
| 3481 | defer if (!comp_destroyed) comp.destroy(); | 3481 | defer if (!comp_destroyed) comp.destroy(); |
| 3482 | 3482 | ||
| 3483 | if (show_builtin) { | 3483 | if (show_builtin) { |
| 3484 | const builtin_mod = comp.root_mod.deps.get("builtin").?; | 3484 | const builtin_mod = comp.root_mod.getBuiltinDependency(); |
| 3485 | const source = builtin_mod.builtin_file.?.source; | 3485 | const source = builtin_mod.builtin_file.?.source; |
| 3486 | return std.io.getStdOut().writeAll(source); | 3486 | return std.io.getStdOut().writeAll(source); |
| 3487 | } | 3487 | } |
src/mingw.zig+17-4| ... | @@ -41,14 +41,16 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -41,14 +41,16 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 41 | //"-D_UNICODE", | 41 | //"-D_UNICODE", |
| 42 | //"-DWPRFLAG=1", | 42 | //"-DWPRFLAG=1", |
| 43 | }); | 43 | }); |
| 44 | return comp.build_crt_file("crt2", .Obj, .@"mingw-w64 crt2.o", prog_node, &.{ | 44 | var files = [_]Compilation.CSourceFile{ |
| 45 | .{ | 45 | .{ |
| 46 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ | 46 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ |
| 47 | "libc", "mingw", "crt", "crtexe.c", | 47 | "libc", "mingw", "crt", "crtexe.c", |
| 48 | }), | 48 | }), |
| 49 | .extra_flags = args.items, | 49 | .extra_flags = args.items, |
| 50 | .owner = undefined, | ||
| 50 | }, | 51 | }, |
| 51 | }); | 52 | }; |
| 53 | return comp.build_crt_file("crt2", .Obj, .@"mingw-w64 crt2.o", prog_node, &files); | ||
| 52 | }, | 54 | }, |
| 53 | 55 | ||
| 54 | .dllcrt2_o => { | 56 | .dllcrt2_o => { |
| ... | @@ -60,14 +62,16 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -60,14 +62,16 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 60 | "-U__CRTDLL__", | 62 | "-U__CRTDLL__", |
| 61 | "-D__MSVCRT__", | 63 | "-D__MSVCRT__", |
| 62 | }); | 64 | }); |
| 63 | return comp.build_crt_file("dllcrt2", .Obj, .@"mingw-w64 dllcrt2.o", prog_node, &.{ | 65 | var files = [_]Compilation.CSourceFile{ |
| 64 | .{ | 66 | .{ |
| 65 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ | 67 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ |
| 66 | "libc", "mingw", "crt", "crtdll.c", | 68 | "libc", "mingw", "crt", "crtdll.c", |
| 67 | }), | 69 | }), |
| 68 | .extra_flags = args.items, | 70 | .extra_flags = args.items, |
| 71 | .owner = undefined, | ||
| 69 | }, | 72 | }, |
| 70 | }); | 73 | }; |
| 74 | return comp.build_crt_file("dllcrt2", .Obj, .@"mingw-w64 dllcrt2.o", prog_node, &files); | ||
| 71 | }, | 75 | }, |
| 72 | 76 | ||
| 73 | .mingw32_lib => { | 77 | .mingw32_lib => { |
| ... | @@ -97,6 +101,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -97,6 +101,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 97 | "libc", "mingw", "crt", dep, | 101 | "libc", "mingw", "crt", dep, |
| 98 | }), | 102 | }), |
| 99 | .extra_flags = args.items, | 103 | .extra_flags = args.items, |
| 104 | .owner = undefined, | ||
| 100 | }; | 105 | }; |
| 101 | } | 106 | } |
| 102 | return comp.build_crt_file("mingw32", .Lib, .@"mingw-w64 mingw32.lib", prog_node, &c_source_files); | 107 | return comp.build_crt_file("mingw32", .Lib, .@"mingw-w64 mingw32.lib", prog_node, &c_source_files); |
| ... | @@ -125,6 +130,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -125,6 +130,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 125 | (try c_source_files.addOne()).* = .{ | 130 | (try c_source_files.addOne()).* = .{ |
| 126 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "mingw", dep }), | 131 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "mingw", dep }), |
| 127 | .extra_flags = extra_flags, | 132 | .extra_flags = extra_flags, |
| 133 | .owner = undefined, | ||
| 128 | }; | 134 | }; |
| 129 | } | 135 | } |
| 130 | if (comp.getTarget().cpu.arch == .x86) { | 136 | if (comp.getTarget().cpu.arch == .x86) { |
| ... | @@ -134,6 +140,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -134,6 +140,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 134 | "libc", "mingw", dep, | 140 | "libc", "mingw", dep, |
| 135 | }), | 141 | }), |
| 136 | .extra_flags = extra_flags, | 142 | .extra_flags = extra_flags, |
| 143 | .owner = undefined, | ||
| 137 | }; | 144 | }; |
| 138 | } | 145 | } |
| 139 | } else { | 146 | } else { |
| ... | @@ -143,6 +150,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -143,6 +150,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 143 | "libc", "mingw", dep, | 150 | "libc", "mingw", dep, |
| 144 | }), | 151 | }), |
| 145 | .extra_flags = extra_flags, | 152 | .extra_flags = extra_flags, |
| 153 | .owner = undefined, | ||
| 146 | }; | 154 | }; |
| 147 | } | 155 | } |
| 148 | } | 156 | } |
| ... | @@ -175,6 +183,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -175,6 +183,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 175 | "libc", "mingw", dep, | 183 | "libc", "mingw", dep, |
| 176 | }), | 184 | }), |
| 177 | .extra_flags = extra_flags, | 185 | .extra_flags = extra_flags, |
| 186 | .owner = undefined, | ||
| 178 | }; | 187 | }; |
| 179 | } | 188 | } |
| 180 | const target = comp.getTarget(); | 189 | const target = comp.getTarget(); |
| ... | @@ -185,6 +194,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -185,6 +194,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 185 | "libc", "mingw", dep, | 194 | "libc", "mingw", dep, |
| 186 | }), | 195 | }), |
| 187 | .extra_flags = extra_flags, | 196 | .extra_flags = extra_flags, |
| 197 | .owner = undefined, | ||
| 188 | }; | 198 | }; |
| 189 | } | 199 | } |
| 190 | } else if (target.cpu.arch.isARM()) { | 200 | } else if (target.cpu.arch.isARM()) { |
| ... | @@ -194,6 +204,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -194,6 +204,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 194 | "libc", "mingw", dep, | 204 | "libc", "mingw", dep, |
| 195 | }), | 205 | }), |
| 196 | .extra_flags = extra_flags, | 206 | .extra_flags = extra_flags, |
| 207 | .owner = undefined, | ||
| 197 | }; | 208 | }; |
| 198 | } | 209 | } |
| 199 | } else if (target.cpu.arch.isAARCH64()) { | 210 | } else if (target.cpu.arch.isAARCH64()) { |
| ... | @@ -203,6 +214,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -203,6 +214,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 203 | "libc", "mingw", dep, | 214 | "libc", "mingw", dep, |
| 204 | }), | 215 | }), |
| 205 | .extra_flags = extra_flags, | 216 | .extra_flags = extra_flags, |
| 217 | .owner = undefined, | ||
| 206 | }; | 218 | }; |
| 207 | } | 219 | } |
| 208 | } else { | 220 | } else { |
| ... | @@ -238,6 +250,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -238,6 +250,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 238 | "libc", "mingw", "libsrc", dep, | 250 | "libc", "mingw", "libsrc", dep, |
| 239 | }), | 251 | }), |
| 240 | .extra_flags = extra_flags, | 252 | .extra_flags = extra_flags, |
| 253 | .owner = undefined, | ||
| 241 | }; | 254 | }; |
| 242 | } | 255 | } |
| 243 | return comp.build_crt_file("uuid", .Lib, .@"mingw-w64 uuid.lib", prog_node, &c_source_files); | 256 | return comp.build_crt_file("uuid", .Lib, .@"mingw-w64 uuid.lib", prog_node, &c_source_files); |
src/musl.zig+26-13| ... | @@ -34,12 +34,14 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -34,12 +34,14 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 34 | try args.appendSlice(&[_][]const u8{ | 34 | try args.appendSlice(&[_][]const u8{ |
| 35 | "-Qunused-arguments", | 35 | "-Qunused-arguments", |
| 36 | }); | 36 | }); |
| 37 | return comp.build_crt_file("crti", .Obj, .@"musl crti.o", prog_node, &.{ | 37 | var files = [_]Compilation.CSourceFile{ |
| 38 | .{ | 38 | .{ |
| 39 | .src_path = try start_asm_path(comp, arena, "crti.s"), | 39 | .src_path = try start_asm_path(comp, arena, "crti.s"), |
| 40 | .extra_flags = args.items, | 40 | .extra_flags = args.items, |
| 41 | .owner = undefined, | ||
| 41 | }, | 42 | }, |
| 42 | }); | 43 | }; |
| 44 | return comp.build_crt_file("crti", .Obj, .@"musl crti.o", prog_node, &files); | ||
| 43 | }, | 45 | }, |
| 44 | .crtn_o => { | 46 | .crtn_o => { |
| 45 | var args = std.ArrayList([]const u8).init(arena); | 47 | var args = std.ArrayList([]const u8).init(arena); |
| ... | @@ -47,12 +49,14 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -47,12 +49,14 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 47 | try args.appendSlice(&[_][]const u8{ | 49 | try args.appendSlice(&[_][]const u8{ |
| 48 | "-Qunused-arguments", | 50 | "-Qunused-arguments", |
| 49 | }); | 51 | }); |
| 50 | return comp.build_crt_file("crtn", .Obj, .@"musl crtn.o", prog_node, &.{ | 52 | var files = [_]Compilation.CSourceFile{ |
| 51 | .{ | 53 | .{ |
| 52 | .src_path = try start_asm_path(comp, arena, "crtn.s"), | 54 | .src_path = try start_asm_path(comp, arena, "crtn.s"), |
| 53 | .extra_flags = args.items, | 55 | .extra_flags = args.items, |
| 56 | .owner = undefined, | ||
| 54 | }, | 57 | }, |
| 55 | }); | 58 | }; |
| 59 | return comp.build_crt_file("crtn", .Obj, .@"musl crtn.o", prog_node, &files); | ||
| 56 | }, | 60 | }, |
| 57 | .crt1_o => { | 61 | .crt1_o => { |
| 58 | var args = std.ArrayList([]const u8).init(arena); | 62 | var args = std.ArrayList([]const u8).init(arena); |
| ... | @@ -61,14 +65,16 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -61,14 +65,16 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 61 | "-fno-stack-protector", | 65 | "-fno-stack-protector", |
| 62 | "-DCRT", | 66 | "-DCRT", |
| 63 | }); | 67 | }); |
| 64 | return comp.build_crt_file("crt1", .Obj, .@"musl crt1.o", prog_node, &.{ | 68 | var files = [_]Compilation.CSourceFile{ |
| 65 | .{ | 69 | .{ |
| 66 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ | 70 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ |
| 67 | "libc", "musl", "crt", "crt1.c", | 71 | "libc", "musl", "crt", "crt1.c", |
| 68 | }), | 72 | }), |
| 69 | .extra_flags = args.items, | 73 | .extra_flags = args.items, |
| 74 | .owner = undefined, | ||
| 70 | }, | 75 | }, |
| 71 | }); | 76 | }; |
| 77 | return comp.build_crt_file("crt1", .Obj, .@"musl crt1.o", prog_node, &files); | ||
| 72 | }, | 78 | }, |
| 73 | .rcrt1_o => { | 79 | .rcrt1_o => { |
| 74 | var args = std.ArrayList([]const u8).init(arena); | 80 | var args = std.ArrayList([]const u8).init(arena); |
| ... | @@ -78,14 +84,16 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -78,14 +84,16 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 78 | "-fno-stack-protector", | 84 | "-fno-stack-protector", |
| 79 | "-DCRT", | 85 | "-DCRT", |
| 80 | }); | 86 | }); |
| 81 | return comp.build_crt_file("rcrt1", .Obj, .@"musl rcrt1.o", prog_node, &.{ | 87 | var files = [_]Compilation.CSourceFile{ |
| 82 | .{ | 88 | .{ |
| 83 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ | 89 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ |
| 84 | "libc", "musl", "crt", "rcrt1.c", | 90 | "libc", "musl", "crt", "rcrt1.c", |
| 85 | }), | 91 | }), |
| 86 | .extra_flags = args.items, | 92 | .extra_flags = args.items, |
| 93 | .owner = undefined, | ||
| 87 | }, | 94 | }, |
| 88 | }); | 95 | }; |
| 96 | return comp.build_crt_file("rcrt1", .Obj, .@"musl rcrt1.o", prog_node, &files); | ||
| 89 | }, | 97 | }, |
| 90 | .scrt1_o => { | 98 | .scrt1_o => { |
| 91 | var args = std.ArrayList([]const u8).init(arena); | 99 | var args = std.ArrayList([]const u8).init(arena); |
| ... | @@ -95,14 +103,16 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -95,14 +103,16 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 95 | "-fno-stack-protector", | 103 | "-fno-stack-protector", |
| 96 | "-DCRT", | 104 | "-DCRT", |
| 97 | }); | 105 | }); |
| 98 | return comp.build_crt_file("Scrt1", .Obj, .@"musl Scrt1.o", prog_node, &.{ | 106 | var files = [_]Compilation.CSourceFile{ |
| 99 | .{ | 107 | .{ |
| 100 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ | 108 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ |
| 101 | "libc", "musl", "crt", "Scrt1.c", | 109 | "libc", "musl", "crt", "Scrt1.c", |
| 102 | }), | 110 | }), |
| 103 | .extra_flags = args.items, | 111 | .extra_flags = args.items, |
| 112 | .owner = undefined, | ||
| 104 | }, | 113 | }, |
| 105 | }); | 114 | }; |
| 115 | return comp.build_crt_file("Scrt1", .Obj, .@"musl Scrt1.o", prog_node, &files); | ||
| 106 | }, | 116 | }, |
| 107 | .libc_a => { | 117 | .libc_a => { |
| 108 | // When there is a src/<arch>/foo.* then it should substitute for src/foo.* | 118 | // When there is a src/<arch>/foo.* then it should substitute for src/foo.* |
| ... | @@ -186,6 +196,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -186,6 +196,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 186 | c_source_file.* = .{ | 196 | c_source_file.* = .{ |
| 187 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", src_file }), | 197 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", src_file }), |
| 188 | .extra_flags = args.items, | 198 | .extra_flags = args.items, |
| 199 | .owner = undefined, | ||
| 189 | }; | 200 | }; |
| 190 | } | 201 | } |
| 191 | return comp.build_crt_file("c", .Lib, .@"musl libc.a", prog_node, c_source_files.items); | 202 | return comp.build_crt_file("c", .Lib, .@"musl libc.a", prog_node, c_source_files.items); |
| ... | @@ -235,7 +246,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -235,7 +246,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 235 | .structured_cfg = comp.root_mod.structured_cfg, | 246 | .structured_cfg = comp.root_mod.structured_cfg, |
| 236 | }, | 247 | }, |
| 237 | .global = config, | 248 | .global = config, |
| 238 | .cc_argv = &.{}, | 249 | .cc_argv = cc_argv, |
| 239 | .parent = null, | 250 | .parent = null, |
| 240 | .builtin_mod = null, | 251 | .builtin_mod = null, |
| 241 | }); | 252 | }); |
| ... | @@ -261,9 +272,11 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -261,9 +272,11 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 261 | .verbose_llvm_cpu_features = comp.verbose_llvm_cpu_features, | 272 | .verbose_llvm_cpu_features = comp.verbose_llvm_cpu_features, |
| 262 | .clang_passthrough_mode = comp.clang_passthrough_mode, | 273 | .clang_passthrough_mode = comp.clang_passthrough_mode, |
| 263 | .c_source_files = &[_]Compilation.CSourceFile{ | 274 | .c_source_files = &[_]Compilation.CSourceFile{ |
| 264 | .{ .src_path = try comp.zig_lib_directory.join(arena, &.{ "libc", "musl", "libc.S" }) }, | 275 | .{ |
| 276 | .src_path = try comp.zig_lib_directory.join(arena, &.{ "libc", "musl", "libc.S" }), | ||
| 277 | .owner = root_mod, | ||
| 278 | }, | ||
| 265 | }, | 279 | }, |
| 266 | .cc_argv = cc_argv, | ||
| 267 | .skip_linker_dependencies = true, | 280 | .skip_linker_dependencies = true, |
| 268 | .soname = "libc.so", | 281 | .soname = "libc.so", |
| 269 | }); | 282 | }); |
src/wasi_libc.zig+16-4| ... | @@ -74,27 +74,31 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -74,27 +74,31 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 74 | var args = std.ArrayList([]const u8).init(arena); | 74 | var args = std.ArrayList([]const u8).init(arena); |
| 75 | try addCCArgs(comp, arena, &args, .{}); | 75 | try addCCArgs(comp, arena, &args, .{}); |
| 76 | try addLibcBottomHalfIncludes(comp, arena, &args); | 76 | try addLibcBottomHalfIncludes(comp, arena, &args); |
| 77 | return comp.build_crt_file("crt1-reactor", .Obj, .@"wasi crt1-reactor.o", prog_node, &.{ | 77 | var files = [_]Compilation.CSourceFile{ |
| 78 | .{ | 78 | .{ |
| 79 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ | 79 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ |
| 80 | "libc", try sanitize(arena, crt1_reactor_src_file), | 80 | "libc", try sanitize(arena, crt1_reactor_src_file), |
| 81 | }), | 81 | }), |
| 82 | .extra_flags = args.items, | 82 | .extra_flags = args.items, |
| 83 | .owner = undefined, | ||
| 83 | }, | 84 | }, |
| 84 | }); | 85 | }; |
| 86 | return comp.build_crt_file("crt1-reactor", .Obj, .@"wasi crt1-reactor.o", prog_node, &files); | ||
| 85 | }, | 87 | }, |
| 86 | .crt1_command_o => { | 88 | .crt1_command_o => { |
| 87 | var args = std.ArrayList([]const u8).init(arena); | 89 | var args = std.ArrayList([]const u8).init(arena); |
| 88 | try addCCArgs(comp, arena, &args, .{}); | 90 | try addCCArgs(comp, arena, &args, .{}); |
| 89 | try addLibcBottomHalfIncludes(comp, arena, &args); | 91 | try addLibcBottomHalfIncludes(comp, arena, &args); |
| 90 | return comp.build_crt_file("crt1-command", .Obj, .@"wasi crt1-command.o", prog_node, &.{ | 92 | var files = [_]Compilation.CSourceFile{ |
| 91 | .{ | 93 | .{ |
| 92 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ | 94 | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ |
| 93 | "libc", try sanitize(arena, crt1_command_src_file), | 95 | "libc", try sanitize(arena, crt1_command_src_file), |
| 94 | }), | 96 | }), |
| 95 | .extra_flags = args.items, | 97 | .extra_flags = args.items, |
| 98 | .owner = undefined, | ||
| 96 | }, | 99 | }, |
| 97 | }); | 100 | }; |
| 101 | return comp.build_crt_file("crt1-command", .Obj, .@"wasi crt1-command.o", prog_node, &files); | ||
| 98 | }, | 102 | }, |
| 99 | .libc_a => { | 103 | .libc_a => { |
| 100 | var libc_sources = std.ArrayList(Compilation.CSourceFile).init(arena); | 104 | var libc_sources = std.ArrayList(Compilation.CSourceFile).init(arena); |
| ... | @@ -109,6 +113,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -109,6 +113,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 109 | "libc", try sanitize(arena, file_path), | 113 | "libc", try sanitize(arena, file_path), |
| 110 | }), | 114 | }), |
| 111 | .extra_flags = args.items, | 115 | .extra_flags = args.items, |
| 116 | .owner = undefined, | ||
| 112 | }); | 117 | }); |
| 113 | } | 118 | } |
| 114 | } | 119 | } |
| ... | @@ -125,6 +130,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -125,6 +130,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 125 | "libc", try sanitize(arena, file_path), | 130 | "libc", try sanitize(arena, file_path), |
| 126 | }), | 131 | }), |
| 127 | .extra_flags = args.items, | 132 | .extra_flags = args.items, |
| 133 | .owner = undefined, | ||
| 128 | }); | 134 | }); |
| 129 | } | 135 | } |
| 130 | } | 136 | } |
| ... | @@ -141,6 +147,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -141,6 +147,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 141 | "libc", try sanitize(arena, file_path), | 147 | "libc", try sanitize(arena, file_path), |
| 142 | }), | 148 | }), |
| 143 | .extra_flags = args.items, | 149 | .extra_flags = args.items, |
| 150 | .owner = undefined, | ||
| 144 | }); | 151 | }); |
| 145 | } | 152 | } |
| 146 | } | 153 | } |
| ... | @@ -159,6 +166,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -159,6 +166,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 159 | "libc", try sanitize(arena, file_path), | 166 | "libc", try sanitize(arena, file_path), |
| 160 | }), | 167 | }), |
| 161 | .extra_flags = args.items, | 168 | .extra_flags = args.items, |
| 169 | .owner = undefined, | ||
| 162 | }); | 170 | }); |
| 163 | } | 171 | } |
| 164 | try comp.build_crt_file("wasi-emulated-process-clocks", .Lib, .@"libwasi-emulated-process-clocks.a", prog_node, emu_clocks_sources.items); | 172 | try comp.build_crt_file("wasi-emulated-process-clocks", .Lib, .@"libwasi-emulated-process-clocks.a", prog_node, emu_clocks_sources.items); |
| ... | @@ -175,6 +183,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -175,6 +183,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 175 | "libc", try sanitize(arena, file_path), | 183 | "libc", try sanitize(arena, file_path), |
| 176 | }), | 184 | }), |
| 177 | .extra_flags = args.items, | 185 | .extra_flags = args.items, |
| 186 | .owner = undefined, | ||
| 178 | }); | 187 | }); |
| 179 | } | 188 | } |
| 180 | try comp.build_crt_file("wasi-emulated-getpid", .Lib, .@"libwasi-emulated-getpid.a", prog_node, emu_getpid_sources.items); | 189 | try comp.build_crt_file("wasi-emulated-getpid", .Lib, .@"libwasi-emulated-getpid.a", prog_node, emu_getpid_sources.items); |
| ... | @@ -191,6 +200,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -191,6 +200,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 191 | "libc", try sanitize(arena, file_path), | 200 | "libc", try sanitize(arena, file_path), |
| 192 | }), | 201 | }), |
| 193 | .extra_flags = args.items, | 202 | .extra_flags = args.items, |
| 203 | .owner = undefined, | ||
| 194 | }); | 204 | }); |
| 195 | } | 205 | } |
| 196 | try comp.build_crt_file("wasi-emulated-mman", .Lib, .@"libwasi-emulated-mman.a", prog_node, emu_mman_sources.items); | 206 | try comp.build_crt_file("wasi-emulated-mman", .Lib, .@"libwasi-emulated-mman.a", prog_node, emu_mman_sources.items); |
| ... | @@ -208,6 +218,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -208,6 +218,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 208 | "libc", try sanitize(arena, file_path), | 218 | "libc", try sanitize(arena, file_path), |
| 209 | }), | 219 | }), |
| 210 | .extra_flags = args.items, | 220 | .extra_flags = args.items, |
| 221 | .owner = undefined, | ||
| 211 | }); | 222 | }); |
| 212 | } | 223 | } |
| 213 | } | 224 | } |
| ... | @@ -224,6 +235,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr | ... | @@ -224,6 +235,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 224 | "libc", try sanitize(arena, file_path), | 235 | "libc", try sanitize(arena, file_path), |
| 225 | }), | 236 | }), |
| 226 | .extra_flags = args.items, | 237 | .extra_flags = args.items, |
| 238 | .owner = undefined, | ||
| 227 | }); | 239 | }); |
| 228 | } | 240 | } |
| 229 | } | 241 | } |