| author | |
| committer | |
| log | 4f921814c0a6555a61d9e0a92fcc6f30bc20e994 |
| tree | 1991b1341621c3b1ec4297a7e93e18a12d3a2693 |
| parent | e949341b705c16b46544f26f5aab0a16670f42b4 |
8 files changed, 184 insertions(+), 120 deletions(-)
lib/zig.h+17-9| ... | ... | @@ -4557,9 +4557,12 @@ static inline void zig_msvc_atomic_store_i128(zig_i128 volatile* obj, zig_i128 a |
| 4557 | 4557 | #include <intrin.h> |
| 4558 | 4558 | #endif |
| 4559 | 4559 | |
| 4560 | static inline void* zig_e_zig_windows_teb(void) zig_mangled(zig_e_zig_windows_teb, "zig_windows_teb"); | |
| 4561 | static inline void* zig_e_zig_windows_peb(void) zig_mangled(zig_e_zig_windows_peb, "zig_windows_peb"); | |
| 4562 | ||
| 4560 | 4563 | #if defined(zig_thumb) |
| 4561 | 4564 | |
| 4562 | static inline void* zig_windows_teb(void) { | |
| 4565 | static inline void* zig_e_zig_windows_teb(void) { | |
| 4563 | 4566 | void* teb = 0; |
| 4564 | 4567 | #if defined(zig_msvc) |
| 4565 | 4568 | teb = (void*)_MoveFromCoprocessor(15, 0, 13, 0, 2); |
| ... | ... | @@ -4571,7 +4574,7 @@ static inline void* zig_windows_teb(void) { |
| 4571 | 4574 | |
| 4572 | 4575 | #elif defined(zig_aarch64) |
| 4573 | 4576 | |
| 4574 | static inline void* zig_windows_teb(void) { | |
| 4577 | static inline void* zig_e_zig_windows_teb(void) { | |
| 4575 | 4578 | void* teb = 0; |
| 4576 | 4579 | #if defined(zig_msvc) |
| 4577 | 4580 | teb = (void*)__readx18qword(0x0); |
| ... | ... | @@ -4583,7 +4586,7 @@ static inline void* zig_windows_teb(void) { |
| 4583 | 4586 | |
| 4584 | 4587 | #elif defined(zig_x86_32) |
| 4585 | 4588 | |
| 4586 | static inline void* zig_windows_teb(void) { | |
| 4589 | static inline void* zig_e_zig_windows_teb(void) { | |
| 4587 | 4590 | void* teb = 0; |
| 4588 | 4591 | #if defined(zig_msvc) |
| 4589 | 4592 | teb = (void*)__readfsdword(0x18); |
| ... | ... | @@ -4593,7 +4596,7 @@ static inline void* zig_windows_teb(void) { |
| 4593 | 4596 | return teb; |
| 4594 | 4597 | } |
| 4595 | 4598 | |
| 4596 | static inline void* zig_windows_peb(void) { | |
| 4599 | static inline void* zig_e_zig_windows_peb(void) { | |
| 4597 | 4600 | void* peb = 0; |
| 4598 | 4601 | #if defined(zig_msvc) |
| 4599 | 4602 | peb = (void*)__readfsdword(0x30); |
| ... | ... | @@ -4605,7 +4608,7 @@ static inline void* zig_windows_peb(void) { |
| 4605 | 4608 | |
| 4606 | 4609 | #elif defined(zig_x86_64) |
| 4607 | 4610 | |
| 4608 | static inline void* zig_windows_teb(void) { | |
| 4611 | static inline void* zig_e_zig_windows_teb(void) { | |
| 4609 | 4612 | void* teb = 0; |
| 4610 | 4613 | #if defined(zig_msvc) |
| 4611 | 4614 | teb = (void*)__readgsqword(0x30); |
| ... | ... | @@ -4615,7 +4618,7 @@ static inline void* zig_windows_teb(void) { |
| 4615 | 4618 | return teb; |
| 4616 | 4619 | } |
| 4617 | 4620 | |
| 4618 | static inline void* zig_windows_peb(void) { | |
| 4621 | static inline void* zig_e_zig_windows_peb(void) { | |
| 4619 | 4622 | void* peb = 0; |
| 4620 | 4623 | #if defined(zig_msvc) |
| 4621 | 4624 | peb = (void*)__readgsqword(0x60); |
| ... | ... | @@ -4629,7 +4632,9 @@ static inline void* zig_windows_peb(void) { |
| 4629 | 4632 | |
| 4630 | 4633 | #if defined(zig_loongarch) |
| 4631 | 4634 | |
| 4632 | static inline void zig_loongarch_cpucfg(uint32_t word, uint32_t* result) { | |
| 4635 | static inline void zig_e_zig_loongarch_cpucfg(uint32_t word, uint32_t* result) zig_mangled(zig_e_zig_loongarch_cpucfg, "zig_loongarch_cpucfg"); | |
| 4636 | ||
| 4637 | static inline void zig_e_zig_loongarch_cpucfg(uint32_t word, uint32_t* result) { | |
| 4633 | 4638 | #if defined(zig_gnuc_asm) |
| 4634 | 4639 | __asm__("cpucfg %[result], %[word]" : [result] "=r" (result) : [word] "r" (word)); |
| 4635 | 4640 | #else |
| ... | ... | @@ -4639,7 +4644,10 @@ static inline void zig_loongarch_cpucfg(uint32_t word, uint32_t* result) { |
| 4639 | 4644 | |
| 4640 | 4645 | #elif defined(zig_x86) && !defined(zig_x86_16) |
| 4641 | 4646 | |
| 4642 | static inline void zig_x86_cpuid(uint32_t leaf_id, uint32_t subid, uint32_t* eax, uint32_t* ebx, uint32_t* ecx, uint32_t* edx) { | |
| 4647 | static inline void zig_e_zig_x86_cpuid(uint32_t leaf_id, uint32_t subid, uint32_t* eax, uint32_t* ebx, uint32_t* ecx, uint32_t* edx) zig_mangled(zig_e_zig_x86_cpuid, "zig_x86_cpuid"); | |
| 4648 | static inline uint32_t zig_e_zig_x86_get_xcr0(void) zig_mangled(zig_e_zig_x86_get_xcr0, "zig_x86_get_xcr0"); | |
| 4649 | ||
| 4650 | static inline void zig_e_zig_x86_cpuid(uint32_t leaf_id, uint32_t subid, uint32_t* eax, uint32_t* ebx, uint32_t* ecx, uint32_t* edx) { | |
| 4643 | 4651 | #if defined(zig_msvc) |
| 4644 | 4652 | int cpu_info[4]; |
| 4645 | 4653 | __cpuidex(cpu_info, leaf_id, subid); |
| ... | ... | @@ -4657,7 +4665,7 @@ static inline void zig_x86_cpuid(uint32_t leaf_id, uint32_t subid, uint32_t* eax |
| 4657 | 4665 | #endif |
| 4658 | 4666 | } |
| 4659 | 4667 | |
| 4660 | static inline uint32_t zig_x86_get_xcr0(void) { | |
| 4668 | static inline uint32_t zig_e_zig_x86_get_xcr0(void) { | |
| 4661 | 4669 | #if defined(zig_msvc) |
| 4662 | 4670 | return (uint32_t)_xgetbv(0); |
| 4663 | 4671 | #elif defined(zig_gnuc_asm) |
src/Compilation.zig+60-49| ... | ... | @@ -103,16 +103,12 @@ native_system_include_paths: []const []const u8, |
| 103 | 103 | /// Corresponds to `-u <symbol>` for ELF/MachO and `/include:<symbol>` for COFF/PE. |
| 104 | 104 | force_undefined_symbols: std.array_hash_map.String(void), |
| 105 | 105 | |
| 106 | c_object_table: std.array_hash_map.Auto(*CObject, void) = .empty, | |
| 107 | win32_resource_table: if (dev.env.supports(.win32_resource)) std.array_hash_map.Auto(*Win32Resource, void) else struct { | |
| 108 | pub fn keys(_: @This()) [0]void { | |
| 109 | return .{}; | |
| 110 | } | |
| 111 | pub fn count(_: @This()) u0 { | |
| 112 | return 0; | |
| 113 | } | |
| 106 | c_objects: std.ArrayList(*CObject) = .empty, | |
| 107 | win32_resources: if (dev.env.supports(.win32_resource)) std.ArrayList(*Win32Resource) else struct { | |
| 108 | items: [0]*struct {}, | |
| 109 | pub const empty: @This() = .{ .items = .{} }; | |
| 114 | 110 | pub fn deinit(_: @This(), _: Allocator) void {} |
| 115 | } = .{}, | |
| 111 | } = .empty, | |
| 116 | 112 | |
| 117 | 113 | link_diags: link.Diags, |
| 118 | 114 | link_queue: link.Queue = .empty, |
| ... | ... | @@ -915,21 +911,6 @@ pub const CrtFile = struct { |
| 915 | 911 | } |
| 916 | 912 | }; |
| 917 | 913 | |
| 918 | /// Supported languages for "zig clang -x <lang>". | |
| 919 | /// Loosely based on llvm-project/clang/include/clang/Driver/Types.def | |
| 920 | pub const LangToExt = std.StaticStringMap(FileExt).initComptime(.{ | |
| 921 | .{ "c", .c }, | |
| 922 | .{ "c-header", .h }, | |
| 923 | .{ "c++", .cpp }, | |
| 924 | .{ "c++-header", .hpp }, | |
| 925 | .{ "objective-c", .m }, | |
| 926 | .{ "objective-c-header", .hm }, | |
| 927 | .{ "objective-c++", .mm }, | |
| 928 | .{ "objective-c++-header", .hmm }, | |
| 929 | .{ "assembler", .assembly }, | |
| 930 | .{ "assembler-with-cpp", .assembly_with_cpp }, | |
| 931 | }); | |
| 932 | ||
| 933 | 914 | /// For passing to a C compiler. |
| 934 | 915 | pub const CSourceFile = struct { |
| 935 | 916 | /// Many C compiler flags are determined by settings contained in the owning Module. |
| ... | ... | @@ -2486,8 +2467,10 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2486 | 2467 | }; |
| 2487 | 2468 | errdefer comp.destroy(); |
| 2488 | 2469 | |
| 2470 | if (target.ofmt == .c) return comp; | |
| 2471 | ||
| 2489 | 2472 | // Add a `CObject` for each `c_source_files`. |
| 2490 | try comp.c_object_table.ensureTotalCapacity(gpa, options.c_source_files.len); | |
| 2473 | try comp.c_objects.ensureTotalCapacity(gpa, options.c_source_files.len); | |
| 2491 | 2474 | for (options.c_source_files) |c_source_file| { |
| 2492 | 2475 | const c_object = try gpa.create(CObject); |
| 2493 | 2476 | errdefer gpa.destroy(c_object); |
| ... | ... | @@ -2496,7 +2479,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2496 | 2479 | .status = .{ .new = {} }, |
| 2497 | 2480 | .src = c_source_file, |
| 2498 | 2481 | }; |
| 2499 | comp.c_object_table.putAssumeCapacityNoClobber(c_object, {}); | |
| 2482 | comp.c_objects.appendAssumeCapacity(c_object); | |
| 2500 | 2483 | } |
| 2501 | 2484 | |
| 2502 | 2485 | // Add a `Win32Resource` for each `rc_source_files` and one for `manifest_file`. |
| ... | ... | @@ -2504,7 +2487,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2504 | 2487 | options.rc_source_files.len + @intFromBool(options.manifest_file != null); |
| 2505 | 2488 | if (win32_resource_count > 0) { |
| 2506 | 2489 | dev.check(.win32_resource); |
| 2507 | try comp.win32_resource_table.ensureTotalCapacity(gpa, win32_resource_count); | |
| 2490 | try comp.win32_resources.ensureTotalCapacity(gpa, win32_resource_count); | |
| 2508 | 2491 | for (options.rc_source_files) |rc_source_file| { |
| 2509 | 2492 | const win32_resource = try gpa.create(Win32Resource); |
| 2510 | 2493 | errdefer gpa.destroy(win32_resource); |
| ... | ... | @@ -2513,7 +2496,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2513 | 2496 | .status = .{ .new = {} }, |
| 2514 | 2497 | .src = .{ .rc = rc_source_file }, |
| 2515 | 2498 | }; |
| 2516 | comp.win32_resource_table.putAssumeCapacityNoClobber(win32_resource, {}); | |
| 2499 | comp.win32_resources.appendAssumeCapacity(win32_resource); | |
| 2517 | 2500 | } |
| 2518 | 2501 | |
| 2519 | 2502 | if (options.manifest_file) |manifest_path| { |
| ... | ... | @@ -2524,11 +2507,11 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2524 | 2507 | .status = .{ .new = {} }, |
| 2525 | 2508 | .src = .{ .manifest = manifest_path }, |
| 2526 | 2509 | }; |
| 2527 | comp.win32_resource_table.putAssumeCapacityNoClobber(win32_resource, {}); | |
| 2510 | comp.win32_resources.appendAssumeCapacity(win32_resource); | |
| 2528 | 2511 | } |
| 2529 | 2512 | } |
| 2530 | 2513 | |
| 2531 | if (comp.emit_bin != null and target.ofmt != .c) { | |
| 2514 | if (comp.emit_bin != null) { | |
| 2532 | 2515 | if (!comp.skip_linker_dependencies) { |
| 2533 | 2516 | // If we need to build libc for the target, add work items for it. |
| 2534 | 2517 | // We go through the work queue so that building can be done in parallel. |
| ... | ... | @@ -2749,20 +2732,20 @@ pub fn destroy(comp: *Compilation) void { |
| 2749 | 2732 | openbsd_file.deinit(gpa, io); |
| 2750 | 2733 | } |
| 2751 | 2734 | |
| 2752 | for (comp.c_object_table.keys()) |key| { | |
| 2753 | key.destroy(gpa, io); | |
| 2735 | for (comp.c_objects.items) |c_object| { | |
| 2736 | c_object.destroy(gpa, io); | |
| 2754 | 2737 | } |
| 2755 | comp.c_object_table.deinit(gpa); | |
| 2738 | comp.c_objects.deinit(gpa); | |
| 2756 | 2739 | |
| 2757 | 2740 | for (comp.failed_c_objects.values()) |bundle| { |
| 2758 | 2741 | bundle.destroy(gpa); |
| 2759 | 2742 | } |
| 2760 | 2743 | comp.failed_c_objects.deinit(gpa); |
| 2761 | 2744 | |
| 2762 | for (comp.win32_resource_table.keys()) |key| { | |
| 2763 | key.destroy(gpa, io); | |
| 2745 | for (comp.win32_resources.items) |win32_resource| { | |
| 2746 | win32_resource.destroy(gpa, io); | |
| 2764 | 2747 | } |
| 2765 | comp.win32_resource_table.deinit(gpa); | |
| 2748 | comp.win32_resources.deinit(gpa); | |
| 2766 | 2749 | |
| 2767 | 2750 | for (comp.failed_win32_resources.values()) |*value| { |
| 2768 | 2751 | value.deinit(gpa); |
| ... | ... | @@ -3016,8 +2999,8 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE |
| 3016 | 2999 | // changes. For now, to avoid crashing the linker in this case, don't kick off C object |
| 3017 | 3000 | // updates if we've done prelink already. https://codeberg.org/ziglang/zig/issues/32081 |
| 3018 | 3001 | } else { |
| 3019 | try comp.c_object_work_queue.ensureUnusedCapacity(gpa, comp.c_object_table.count()); | |
| 3020 | for (comp.c_object_table.keys()) |c_object| { | |
| 3002 | try comp.c_object_work_queue.ensureUnusedCapacity(gpa, comp.c_objects.items.len); | |
| 3003 | for (comp.c_objects.items) |c_object| { | |
| 3021 | 3004 | comp.c_object_work_queue.pushBackAssumeCapacity(c_object); |
| 3022 | 3005 | try comp.appendFileSystemInput(try .fromUnresolved(arena, comp.dirs, &.{c_object.src.src_path})); |
| 3023 | 3006 | } |
| ... | ... | @@ -3032,8 +3015,8 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE |
| 3032 | 3015 | |
| 3033 | 3016 | // For compiling Win32 resources, we rely on the cache hash system to avoid duplicating work. |
| 3034 | 3017 | // Add a Job for each Win32 resource file. |
| 3035 | try comp.win32_resource_work_queue.ensureUnusedCapacity(gpa, comp.win32_resource_table.count()); | |
| 3036 | for (comp.win32_resource_table.keys()) |win32_resource| { | |
| 3018 | try comp.win32_resource_work_queue.ensureUnusedCapacity(gpa, comp.win32_resources.items.len); | |
| 3019 | for (comp.win32_resources.items) |win32_resource| { | |
| 3037 | 3020 | comp.win32_resource_work_queue.pushBackAssumeCapacity(win32_resource); |
| 3038 | 3021 | switch (win32_resource.src) { |
| 3039 | 3022 | .rc => |f| { |
| ... | ... | @@ -3140,9 +3123,9 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE |
| 3140 | 3123 | return; |
| 3141 | 3124 | } |
| 3142 | 3125 | |
| 3143 | if (comp.zcu == null and comp.config.output_mode == .Obj and comp.c_object_table.count() == 1) { | |
| 3126 | if (comp.zcu == null and comp.config.output_mode == .Obj and comp.c_objects.items.len == 1) { | |
| 3144 | 3127 | // This is `zig build-obj foo.c`. We can emit asm and LLVM IR/bitcode. |
| 3145 | const c_obj_path = comp.c_object_table.keys()[0].status.success.object_path; | |
| 3128 | const c_obj_path = comp.c_objects.items[0].status.success.object_path; | |
| 3146 | 3129 | if (comp.emit_asm) |path| try comp.emitFromCObject(arena, c_obj_path, ".s", path); |
| 3147 | 3130 | if (comp.emit_llvm_ir) |path| try comp.emitFromCObject(arena, c_obj_path, ".ll", path); |
| 3148 | 3131 | if (comp.emit_llvm_bc) |path| try comp.emitFromCObject(arena, c_obj_path, ".bc", path); |
| ... | ... | @@ -3482,14 +3465,14 @@ fn addNonIncrementalStuffToCacheManifest( |
| 3482 | 3465 | |
| 3483 | 3466 | try link.hashInputs(man, comp.link_inputs); |
| 3484 | 3467 | |
| 3485 | for (comp.c_object_table.keys()) |key| { | |
| 3486 | _ = try man.addFile(key.src.src_path, null); | |
| 3487 | man.hash.addOptional(key.src.ext); | |
| 3488 | man.hash.addListOfBytes(key.src.extra_flags); | |
| 3468 | for (comp.c_objects.items) |c_object| { | |
| 3469 | _ = try man.addFile(c_object.src.src_path, null); | |
| 3470 | man.hash.addOptional(c_object.src.ext); | |
| 3471 | man.hash.addListOfBytes(c_object.src.extra_flags); | |
| 3489 | 3472 | } |
| 3490 | 3473 | |
| 3491 | for (comp.win32_resource_table.keys()) |key| { | |
| 3492 | switch (key.src) { | |
| 3474 | for (comp.win32_resources.items) |win32_resource| { | |
| 3475 | switch (win32_resource.src) { | |
| 3493 | 3476 | .rc => |rc_src| { |
| 3494 | 3477 | _ = try man.addFile(rc_src.src_path, null); |
| 3495 | 3478 | man.hash.addListOfBytes(rc_src.extra_flags); |
| ... | ... | @@ -5592,9 +5575,10 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr |
| 5592 | 5575 | c_source_basename[0 .. c_source_basename.len - fs.path.extension(c_source_basename).len]; |
| 5593 | 5576 | |
| 5594 | 5577 | const target = comp.getTarget(); |
| 5578 | assert(target.ofmt != .c); | |
| 5595 | 5579 | const o_ext = target.ofmt.fileExt(target.cpu.arch); |
| 5596 | 5580 | const digest = if (!comp.disable_c_depfile and try man.hit()) man.final() else blk: { |
| 5597 | var argv = std.array_list.Managed([]const u8).init(gpa); | |
| 5581 | var argv: std.array_list.Managed([]const u8) = .init(gpa); | |
| 5598 | 5582 | defer argv.deinit(); |
| 5599 | 5583 | |
| 5600 | 5584 | // In case we are doing passthrough mode, we need to detect -S and -emit-llvm. |
| ... | ... | @@ -7057,6 +7041,33 @@ pub const FileExt = enum { |
| 7057 | 7041 | .unknown => "", |
| 7058 | 7042 | }; |
| 7059 | 7043 | } |
| 7044 | ||
| 7045 | /// The value accepted by "zig clang -x <lang>" and passed to "clang -x <lang>". | |
| 7046 | pub fn toLang(ext: FileExt) ?[]const u8 { | |
| 7047 | return switch (ext) { | |
| 7048 | else => null, | |
| 7049 | .c => "c", | |
| 7050 | .h => "c-header", | |
| 7051 | .cpp => "c++", | |
| 7052 | .hpp => "c++-header", | |
| 7053 | .m => "objective-c", | |
| 7054 | .hm => "objective-c-header", | |
| 7055 | .mm => "objective-c++", | |
| 7056 | .hmm => "objective-c++-header", | |
| 7057 | .assembly => "assembler", | |
| 7058 | .assembly_with_cpp => "assembler-with-cpp", | |
| 7059 | }; | |
| 7060 | } | |
| 7061 | ||
| 7062 | /// Supported languages for "zig clang -x <lang>". | |
| 7063 | /// Loosely based on llvm-project/clang/include/clang/Driver/Types.def | |
| 7064 | pub const from_lang = std.StaticStringMap(FileExt).initComptime(init: { | |
| 7065 | var init: []const struct { []const u8, FileExt } = &.{}; | |
| 7066 | for (std.enums.values(FileExt)) |file_ext| if (file_ext.toLang()) |lang| { | |
| 7067 | init = init ++ .{.{ lang, file_ext }}; | |
| 7068 | }; | |
| 7069 | break :init init; | |
| 7070 | }); | |
| 7060 | 7071 | }; |
| 7061 | 7072 | |
| 7062 | 7073 | pub fn hasObjectExt(filename: []const u8) bool { |
src/codegen/c.zig+4-1| ... | ... | @@ -328,6 +328,9 @@ fn isReservedIdent(ident: []const u8) bool { |
| 328 | 328 | return true; |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | // zig.h | |
| 332 | if (mem.startsWith(u8, ident, "zig_")) return true; | |
| 333 | ||
| 331 | 334 | return reserved_idents.has(ident); |
| 332 | 335 | } |
| 333 | 336 | |
| ... | ... | @@ -3755,7 +3758,7 @@ fn airCmpLteErrorsLen(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3755 | 3758 | try f.writeCValue(w, local, .other); |
| 3756 | 3759 | try w.writeAll(" = "); |
| 3757 | 3760 | try f.writeCValue(w, operand, .other); |
| 3758 | try w.print(" < sizeof({f}) / sizeof(*{0f});", .{fmtIdentSolo("zig_errorName")}); | |
| 3761 | try w.writeAll(" < sizeof(zig_errorName) / sizeof(*zig_errorName);"); | |
| 3759 | 3762 | try f.newline(); |
| 3760 | 3763 | return local; |
| 3761 | 3764 | } |
src/link.zig+2-2| ... | ... | @@ -933,8 +933,8 @@ pub const File = struct { |
| 933 | 933 | // Until then, we do `lld -r -o output.o input.o` even though the output is the same |
| 934 | 934 | // as the input. For the preprocessing case (`zig cc -E -o foo`) we copy the file |
| 935 | 935 | // to the final location. See also the corresponding TODO in Coff linking. |
| 936 | assert(comp.c_object_table.count() == 1); | |
| 937 | const the_key = comp.c_object_table.keys()[0]; | |
| 936 | assert(comp.c_objects.items.len == 1); | |
| 937 | const the_key = comp.c_objects.items[0]; | |
| 938 | 938 | const cached_pp_file_path = the_key.status.success.object_path; |
| 939 | 939 | Io.Dir.copyFile( |
| 940 | 940 | cached_pp_file_path.root_dir.handle, |
src/link/Lld.zig+20-20| ... | ... | @@ -313,14 +313,14 @@ fn linkAsArchive(lld: *Lld, arena: Allocator) !void { |
| 313 | 313 | object_files.appendAssumeCapacity(try input.path().?.toStringZ(arena)); |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | try object_files.ensureUnusedCapacity(arena, comp.c_object_table.count() + | |
| 317 | comp.win32_resource_table.count() + 2); | |
| 316 | try object_files.ensureUnusedCapacity(arena, comp.c_objects.items.len + | |
| 317 | comp.win32_resources.items.len + 2); | |
| 318 | 318 | |
| 319 | for (comp.c_object_table.keys()) |key| { | |
| 320 | object_files.appendAssumeCapacity(try key.status.success.object_path.toStringZ(arena)); | |
| 319 | for (comp.c_objects.items) |c_object| { | |
| 320 | object_files.appendAssumeCapacity(try c_object.status.success.object_path.toStringZ(arena)); | |
| 321 | 321 | } |
| 322 | for (comp.win32_resource_table.keys()) |key| { | |
| 323 | object_files.appendAssumeCapacity(try arena.dupeSentinel(u8, key.status.success.res_path, 0)); | |
| 322 | for (comp.win32_resources.items) |win32_resource| { | |
| 323 | object_files.appendAssumeCapacity(try arena.dupeSentinel(u8, win32_resource.status.success.res_path, 0)); | |
| 324 | 324 | } |
| 325 | 325 | if (zcu_obj_path) |p| object_files.appendAssumeCapacity(try p.toStringZ(arena)); |
| 326 | 326 | if (compiler_rt_path) |p| object_files.appendAssumeCapacity(try p.toStringZ(arena)); |
| ... | ... | @@ -395,8 +395,8 @@ fn coffLink(lld: *Lld, arena: Allocator) !void { |
| 395 | 395 | const the_object_path = blk: { |
| 396 | 396 | if (link.firstObjectInput(comp.link_inputs)) |obj| break :blk obj.path; |
| 397 | 397 | |
| 398 | if (comp.c_object_table.count() != 0) | |
| 399 | break :blk comp.c_object_table.keys()[0].status.success.object_path; | |
| 398 | if (comp.c_objects.items.len != 0) | |
| 399 | break :blk comp.c_objects.items[0].status.success.object_path; | |
| 400 | 400 | |
| 401 | 401 | if (zcu_obj_path) |p| |
| 402 | 402 | break :blk p; |
| ... | ... | @@ -546,12 +546,12 @@ fn coffLink(lld: *Lld, arena: Allocator) !void { |
| 546 | 546 | }, |
| 547 | 547 | }; |
| 548 | 548 | |
| 549 | for (comp.c_object_table.keys()) |key| { | |
| 550 | try argv.append(try key.status.success.object_path.toString(arena)); | |
| 549 | for (comp.c_objects.items) |c_object| { | |
| 550 | try argv.append(try c_object.status.success.object_path.toString(arena)); | |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | for (comp.win32_resource_table.keys()) |key| { | |
| 554 | try argv.append(key.status.success.res_path); | |
| 553 | for (comp.win32_resources.items) |win32_resource| { | |
| 554 | try argv.append(win32_resource.status.success.res_path); | |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | if (zcu_obj_path) |p| { |
| ... | ... | @@ -805,8 +805,8 @@ fn elfLink(lld: *Lld, arena: Allocator) !void { |
| 805 | 805 | const the_object_path = blk: { |
| 806 | 806 | if (link.firstObjectInput(comp.link_inputs)) |obj| break :blk obj.path; |
| 807 | 807 | |
| 808 | if (comp.c_object_table.count() != 0) | |
| 809 | break :blk comp.c_object_table.keys()[0].status.success.object_path; | |
| 808 | if (comp.c_objects.items.len != 0) | |
| 809 | break :blk comp.c_objects.items[0].status.success.object_path; | |
| 810 | 810 | |
| 811 | 811 | if (zcu_obj_path) |p| |
| 812 | 812 | break :blk p; |
| ... | ... | @@ -1099,8 +1099,8 @@ fn elfLink(lld: *Lld, arena: Allocator) !void { |
| 1099 | 1099 | whole_archive = false; |
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | for (comp.c_object_table.keys()) |key| { | |
| 1103 | try argv.append(try key.status.success.object_path.toString(arena)); | |
| 1102 | for (comp.c_objects.items) |c_object| { | |
| 1103 | try argv.append(try c_object.status.success.object_path.toString(arena)); | |
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | 1106 | if (zcu_obj_path) |p| { |
| ... | ... | @@ -1381,8 +1381,8 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void { |
| 1381 | 1381 | const the_object_path = blk: { |
| 1382 | 1382 | if (link.firstObjectInput(comp.link_inputs)) |obj| break :blk obj.path; |
| 1383 | 1383 | |
| 1384 | if (comp.c_object_table.count() != 0) | |
| 1385 | break :blk comp.c_object_table.keys()[0].status.success.object_path; | |
| 1384 | if (comp.c_objects.items.len != 0) | |
| 1385 | break :blk comp.c_objects.items[0].status.success.object_path; | |
| 1386 | 1386 | |
| 1387 | 1387 | if (zcu_obj_path) |p| |
| 1388 | 1388 | break :blk p; |
| ... | ... | @@ -1566,8 +1566,8 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void { |
| 1566 | 1566 | whole_archive = false; |
| 1567 | 1567 | } |
| 1568 | 1568 | |
| 1569 | for (comp.c_object_table.keys()) |key| { | |
| 1570 | try argv.append(try key.status.success.object_path.toString(arena)); | |
| 1569 | for (comp.c_objects.items) |c_object| { | |
| 1570 | try argv.append(try c_object.status.success.object_path.toString(arena)); | |
| 1571 | 1571 | } |
| 1572 | 1572 | if (zcu_obj_path) |p| { |
| 1573 | 1573 | try argv.append(try p.toString(arena)); |
src/link/MachO.zig+7-7| ... | ... | @@ -377,9 +377,9 @@ pub fn flush( |
| 377 | 377 | // This is a set of object files emitted by clang in a single `build-exe` invocation. |
| 378 | 378 | // For instance, the implicit `a.o` as compiled by `zig build-exe a.c` will end up |
| 379 | 379 | // in this set. |
| 380 | try positionals.ensureUnusedCapacity(comp.c_object_table.keys().len); | |
| 381 | for (comp.c_object_table.keys()) |key| { | |
| 382 | positionals.appendAssumeCapacity(try link.openObjectInput(io, diags, key.status.success.object_path)); | |
| 380 | try positionals.ensureUnusedCapacity(comp.c_objects.items.len); | |
| 381 | for (comp.c_objects.items) |c_object| { | |
| 382 | positionals.appendAssumeCapacity(try link.openObjectInput(io, diags, c_object.status.success.object_path)); | |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | if (zcu_obj_path) |path| try positionals.append(try link.openObjectInput(io, diags, path)); |
| ... | ... | @@ -657,8 +657,8 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void { |
| 657 | 657 | .dso_exact => |dso_exact| try argv.appendSlice(&.{ "-l", dso_exact.name }), |
| 658 | 658 | }; |
| 659 | 659 | |
| 660 | for (comp.c_object_table.keys()) |key| { | |
| 661 | try argv.append(try key.status.success.object_path.toString(arena)); | |
| 660 | for (comp.c_objects.items) |c_object| { | |
| 661 | try argv.append(try c_object.status.success.object_path.toString(arena)); | |
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | if (zcu_obj_path) |p| { |
| ... | ... | @@ -749,8 +749,8 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void { |
| 749 | 749 | .dso_exact => |dso_exact| try argv.appendSlice(&.{ "-l", dso_exact.name }), |
| 750 | 750 | }; |
| 751 | 751 | |
| 752 | for (comp.c_object_table.keys()) |key| { | |
| 753 | try argv.append(try key.status.success.object_path.toString(arena)); | |
| 752 | for (comp.c_objects.items) |c_object| { | |
| 753 | try argv.append(try c_object.status.success.object_path.toString(arena)); | |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | if (zcu_obj_path) |p| { |
src/link/MachO/relocatable.zig+4-4| ... | ... | @@ -9,8 +9,8 @@ pub fn flushObject(macho_file: *MachO, comp: *Compilation, module_obj_path: ?Pat |
| 9 | 9 | try positionals.ensureUnusedCapacity(comp.link_inputs.len); |
| 10 | 10 | positionals.appendSliceAssumeCapacity(comp.link_inputs); |
| 11 | 11 | |
| 12 | for (comp.c_object_table.keys()) |key| { | |
| 13 | try positionals.append(try link.openObjectInput(io, diags, key.status.success.object_path)); | |
| 12 | for (comp.c_objects.items) |c_object| { | |
| 13 | try positionals.append(try link.openObjectInput(io, diags, c_object.status.success.object_path)); | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | if (module_obj_path) |path| try positionals.append(try link.openObjectInput(io, diags, path)); |
| ... | ... | @@ -86,8 +86,8 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ? |
| 86 | 86 | try positionals.ensureUnusedCapacity(comp.link_inputs.len); |
| 87 | 87 | positionals.appendSliceAssumeCapacity(comp.link_inputs); |
| 88 | 88 | |
| 89 | for (comp.c_object_table.keys()) |key| { | |
| 90 | try positionals.append(try link.openObjectInput(io, diags, key.status.success.object_path)); | |
| 89 | for (comp.c_objects.items) |c_object| { | |
| 90 | try positionals.append(try link.openObjectInput(io, diags, c_object.status.success.object_path)); | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | if (module_obj_path) |path| try positionals.append(try link.openObjectInput(io, diags, path)); |
src/main.zig+70-28| ... | ... | @@ -887,6 +887,7 @@ const CliModule = struct { |
| 887 | 887 | inherited: Package.Module.CreateOptions.Inherited, |
| 888 | 888 | target_arch_os_abi: ?[]const u8, |
| 889 | 889 | target_mcpu: ?[]const u8, |
| 890 | dynamic_linker: ?[]const u8, | |
| 890 | 891 | |
| 891 | 892 | deps: []const Dep, |
| 892 | 893 | resolved: ?*Package.Module, |
| ... | ... | @@ -943,6 +944,7 @@ fn buildOutputType( |
| 943 | 944 | var emit_implib_arg_provided = false; |
| 944 | 945 | var target_arch_os_abi: ?[]const u8 = null; |
| 945 | 946 | var target_mcpu: ?[]const u8 = null; |
| 947 | var dynamic_linker: ?[]const u8 = null; | |
| 946 | 948 | var emit_h: Emit = .no; |
| 947 | 949 | var soname: SOName = undefined; |
| 948 | 950 | var want_compiler_rt: ?bool = null; |
| ... | ... | @@ -1059,7 +1061,6 @@ fn buildOutputType( |
| 1059 | 1061 | // Populated just before the call to `createModule`. |
| 1060 | 1062 | .dirs = undefined, |
| 1061 | 1063 | .object_format = null, |
| 1062 | .dynamic_linker = null, | |
| 1063 | 1064 | .modules = .empty, |
| 1064 | 1065 | .opts = .{ |
| 1065 | 1066 | .is_test = switch (arg_mode) { |
| ... | ... | @@ -1179,6 +1180,7 @@ fn buildOutputType( |
| 1179 | 1180 | &cc_argv, |
| 1180 | 1181 | &target_arch_os_abi, |
| 1181 | 1182 | &target_mcpu, |
| 1183 | &dynamic_linker, | |
| 1182 | 1184 | &deps, |
| 1183 | 1185 | &c_source_files_owner_index, |
| 1184 | 1186 | &rc_source_files_owner_index, |
| ... | ... | @@ -1397,9 +1399,9 @@ fn buildOutputType( |
| 1397 | 1399 | } else if (mem.cutPrefix(u8, arg, "-O")) |rest| { |
| 1398 | 1400 | mod_opts.optimize_mode = parseOptimizeMode(rest); |
| 1399 | 1401 | } else if (mem.eql(u8, arg, "--dynamic-linker")) { |
| 1400 | create_module.dynamic_linker = args_iter.nextOrFatal(); | |
| 1402 | dynamic_linker = args_iter.nextOrFatal(); | |
| 1401 | 1403 | } else if (mem.eql(u8, arg, "--no-dynamic-linker")) { |
| 1402 | create_module.dynamic_linker = ""; | |
| 1404 | dynamic_linker = ""; | |
| 1403 | 1405 | } else if (mem.eql(u8, arg, "--sysroot")) { |
| 1404 | 1406 | const next_arg = args_iter.nextOrFatal(); |
| 1405 | 1407 | create_module.sysroot = next_arg; |
| ... | ... | @@ -1846,7 +1848,7 @@ fn buildOutputType( |
| 1846 | 1848 | const lang = if (rest.len == 0) args_iter.nextOrFatal() else rest; |
| 1847 | 1849 | if (mem.eql(u8, lang, "none")) { |
| 1848 | 1850 | file_ext = null; |
| 1849 | } else if (Compilation.LangToExt.get(lang)) |got_ext| { | |
| 1851 | } else if (Compilation.FileExt.from_lang.get(lang)) |got_ext| { | |
| 1850 | 1852 | file_ext = got_ext; |
| 1851 | 1853 | } else { |
| 1852 | 1854 | fatal("language not recognized: {s}", .{lang}); |
| ... | ... | @@ -1983,7 +1985,7 @@ fn buildOutputType( |
| 1983 | 1985 | const lang = mem.sliceTo(it.only_arg, 0); |
| 1984 | 1986 | if (mem.eql(u8, lang, "none")) { |
| 1985 | 1987 | file_ext = null; |
| 1986 | } else if (Compilation.LangToExt.get(lang)) |got_ext| { | |
| 1988 | } else if (Compilation.FileExt.from_lang.get(lang)) |got_ext| { | |
| 1987 | 1989 | file_ext = got_ext; |
| 1988 | 1990 | } else { |
| 1989 | 1991 | fatal("language not recognized: {q}", .{lang}); |
| ... | ... | @@ -2610,12 +2612,11 @@ fn buildOutputType( |
| 2610 | 2612 | mem.eql(u8, arg, "--dynamic-linker") or |
| 2611 | 2613 | mem.eql(u8, arg, "-dynamic-linker")) |
| 2612 | 2614 | { |
| 2613 | create_module.dynamic_linker = linker_args_it.nextOrFatal(); | |
| 2614 | } else if (mem.eql(u8, arg, "-I") or | |
| 2615 | mem.eql(u8, arg, "--no-dynamic-linker") or | |
| 2615 | dynamic_linker = linker_args_it.nextOrFatal(); | |
| 2616 | } else if (mem.eql(u8, arg, "--no-dynamic-linker") or | |
| 2616 | 2617 | mem.eql(u8, arg, "-no-dynamic-linker")) |
| 2617 | 2618 | { |
| 2618 | create_module.dynamic_linker = ""; | |
| 2619 | dynamic_linker = ""; | |
| 2619 | 2620 | } else if (mem.eql(u8, arg, "-E") or |
| 2620 | 2621 | mem.eql(u8, arg, "--export-dynamic") or |
| 2621 | 2622 | mem.eql(u8, arg, "-export-dynamic")) |
| ... | ... | @@ -3184,6 +3185,7 @@ fn buildOutputType( |
| 3184 | 3185 | .inherited = mod_opts, |
| 3185 | 3186 | .target_arch_os_abi = target_arch_os_abi, |
| 3186 | 3187 | .target_mcpu = target_mcpu, |
| 3188 | .dynamic_linker = dynamic_linker, | |
| 3187 | 3189 | .deps = try deps.toOwnedSlice(arena), |
| 3188 | 3190 | .resolved = null, |
| 3189 | 3191 | .c_source_files_start = c_source_files_owner_index, |
| ... | ... | @@ -3842,10 +3844,59 @@ fn buildOutputType( |
| 3842 | 3844 | if (test_exec_args.items.len == 0 and target.ofmt == .c and emit_bin_resolved != .no) { |
| 3843 | 3845 | // Default to using `zig run` to execute the produced .c code from `zig test`. |
| 3844 | 3846 | try test_exec_args.appendSlice(arena, &.{ self_exe_path, "run" }); |
| 3845 | if (dirs.zig_lib.path) |p| { | |
| 3846 | try test_exec_args.appendSlice(arena, &.{ "-I", p }); | |
| 3847 | // Skip passing `-ofmt`, we want the default for the target, not `.c` anymore. | |
| 3848 | ||
| 3849 | var prev_has_cflags = false; | |
| 3850 | var prev_has_rcflags = false; | |
| 3851 | if (dirs.zig_lib.path) |zig_lib_path| { | |
| 3852 | try test_exec_args.appendSlice(arena, &.{ "-cflags", "-I", zig_lib_path, "--" }); | |
| 3853 | prev_has_cflags = true; | |
| 3854 | } | |
| 3855 | try test_exec_args.append(arena, null); | |
| 3856 | for (create_module.modules.keys(), create_module.modules.values()) |mod_name, mod| { | |
| 3857 | for (create_module.c_source_files.items[mod.c_source_files_start..mod.c_source_files_end]) |c_source_file| { | |
| 3858 | const cflags_len = c_source_file.extra_flags.len + c_source_file.cache_exempt_flags.len; | |
| 3859 | if (prev_has_cflags or cflags_len > 0) { | |
| 3860 | try test_exec_args.ensureUnusedCapacity(arena, 1 + cflags_len + 1); | |
| 3861 | test_exec_args.appendAssumeCapacity("-cflags"); | |
| 3862 | for (c_source_file.extra_flags) |extra_flag| test_exec_args.appendAssumeCapacity(extra_flag); | |
| 3863 | for (c_source_file.cache_exempt_flags) |cache_exempt_flag| test_exec_args.appendAssumeCapacity(cache_exempt_flag); | |
| 3864 | test_exec_args.appendAssumeCapacity("--"); | |
| 3865 | } | |
| 3866 | prev_has_cflags = cflags_len > 0; | |
| 3867 | if (c_source_file.ext) |ext| try test_exec_args.appendSlice(arena, &.{ "-x", ext.toLang() }); | |
| 3868 | try test_exec_args.append(arena, c_source_file.src_path); | |
| 3869 | if (c_source_file.ext) |_| try test_exec_args.appendSlice(arena, &.{ "-x", "none" }); | |
| 3870 | } | |
| 3871 | for (create_module.rc_source_files.items[mod.rc_source_files_start..mod.rc_source_files_end]) |rc_source_file| { | |
| 3872 | const rcflags_len = rc_source_file.extra_flags.len; | |
| 3873 | if (prev_has_rcflags or rcflags_len > 0) { | |
| 3874 | try test_exec_args.ensureUnusedCapacity(arena, 1 + rcflags_len + 1); | |
| 3875 | test_exec_args.appendAssumeCapacity("-rcflags"); | |
| 3876 | for (rc_source_file.extra_flags) |extra_flag| test_exec_args.appendAssumeCapacity(extra_flag); | |
| 3877 | test_exec_args.appendAssumeCapacity("--"); | |
| 3878 | } | |
| 3879 | prev_has_rcflags = rcflags_len > 0; | |
| 3880 | try test_exec_args.append(arena, rc_source_file.src_path); | |
| 3881 | } | |
| 3882 | if (mod.target_arch_os_abi) |triple| try test_exec_args.appendSlice(arena, &.{ "-target", triple }); | |
| 3883 | if (mod.target_mcpu) |mcpu| try test_exec_args.appendSlice(arena, &.{ "-mcpu", mcpu }); | |
| 3884 | if (mod.dynamic_linker) |dl| if (dl.len > 0) | |
| 3885 | try test_exec_args.appendSlice(arena, &.{ "--dynamic-linker", dl }) | |
| 3886 | else | |
| 3887 | try test_exec_args.append(arena, "--no-dynamic-linker"); | |
| 3888 | try test_exec_args.ensureUnusedCapacity(arena, mod.cc_argv.len); | |
| 3889 | for (mod.cc_argv) |cc_arg| test_exec_args.appendAssumeCapacity(cc_arg); | |
| 3890 | for (mod.deps) |dep| try test_exec_args.appendSlice(arena, &.{ | |
| 3891 | "--dep", | |
| 3892 | if (std.mem.eql(u8, dep.key, dep.value)) dep.value else try std.fmt.allocPrint(arena, "{s}={s}", .{ dep.key, dep.value }), | |
| 3893 | }); | |
| 3894 | try test_exec_args.append(arena, try std.fmt.allocPrint(arena, "-M{s}", .{mod_name})); | |
| 3847 | 3895 | } |
| 3848 | 3896 | |
| 3897 | try test_exec_args.ensureUnusedCapacity(arena, comp.global_cc_argv.len); | |
| 3898 | for (comp.global_cc_argv) |global_cc_arg| test_exec_args.appendAssumeCapacity(global_cc_arg); | |
| 3899 | if (create_module.resolved_options.link_libcpp) try test_exec_args.append(arena, "-lc++"); | |
| 3849 | 3900 | if (create_module.resolved_options.link_libc) { |
| 3850 | 3901 | try test_exec_args.append(arena, "-lc"); |
| 3851 | 3902 | } else if (target.os.tag == .windows) { |
| ... | ... | @@ -3855,21 +3906,10 @@ fn buildOutputType( |
| 3855 | 3906 | }); |
| 3856 | 3907 | } |
| 3857 | 3908 | |
| 3858 | const first_cli_mod = create_module.modules.values()[0]; | |
| 3859 | if (first_cli_mod.target_arch_os_abi) |triple| { | |
| 3860 | try test_exec_args.appendSlice(arena, &.{ "-target", triple }); | |
| 3861 | } | |
| 3862 | if (first_cli_mod.target_mcpu) |mcpu| { | |
| 3863 | try test_exec_args.append(arena, try std.fmt.allocPrint(arena, "-mcpu={s}", .{mcpu})); | |
| 3864 | } | |
| 3865 | if (create_module.dynamic_linker) |dl| { | |
| 3866 | if (dl.len > 0) { | |
| 3867 | try test_exec_args.appendSlice(arena, &.{ "--dynamic-linker", dl }); | |
| 3868 | } else { | |
| 3869 | try test_exec_args.append(arena, "--no-dynamic-linker"); | |
| 3870 | } | |
| 3871 | } | |
| 3872 | try test_exec_args.append(arena, null); // placeholder for the path of the emitted C source file | |
| 3909 | try test_exec_args.ensureUnusedCapacity(arena, 2 * log_scopes.items.len + @intFromBool(verbose_link) + @intFromBool(verbose_cc)); | |
| 3910 | for (log_scopes.items) |log_scope| test_exec_args.appendSliceAssumeCapacity(&.{ "--debug-log", log_scope }); | |
| 3911 | if (verbose_link) test_exec_args.appendAssumeCapacity("--verbose-link"); | |
| 3912 | if (verbose_cc) test_exec_args.appendAssumeCapacity("--verbose-cc"); | |
| 3873 | 3913 | } |
| 3874 | 3914 | |
| 3875 | 3915 | try runOrTest( |
| ... | ... | @@ -3898,7 +3938,6 @@ const CreateModule = struct { |
| 3898 | 3938 | dirs: Compilation.Directories, |
| 3899 | 3939 | modules: std.array_hash_map.String(CliModule), |
| 3900 | 3940 | opts: Compilation.Config.Options, |
| 3901 | dynamic_linker: ?[]const u8, | |
| 3902 | 3941 | object_format: ?[]const u8, |
| 3903 | 3942 | /// undefined until createModule() for the root module is called. |
| 3904 | 3943 | resolved_options: Compilation.Config, |
| ... | ... | @@ -3960,7 +3999,7 @@ fn createModule( |
| 3960 | 3999 | var target_parse_options: std.Target.Query.ParseOptions = .{ |
| 3961 | 4000 | .arch_os_abi = cli_mod.target_arch_os_abi orelse "native", |
| 3962 | 4001 | .cpu_features = cli_mod.target_mcpu, |
| 3963 | .dynamic_linker = create_module.dynamic_linker, | |
| 4002 | .dynamic_linker = cli_mod.dynamic_linker, | |
| 3964 | 4003 | .object_format = create_module.object_format, |
| 3965 | 4004 | }; |
| 3966 | 4005 | |
| ... | ... | @@ -7844,6 +7883,7 @@ fn handleModArg( |
| 7844 | 7883 | cc_argv: *std.ArrayList([]const u8), |
| 7845 | 7884 | target_arch_os_abi: *?[]const u8, |
| 7846 | 7885 | target_mcpu: *?[]const u8, |
| 7886 | dynamic_linker: *?[]const u8, | |
| 7847 | 7887 | deps: *std.ArrayList(CliModule.Dep), |
| 7848 | 7888 | c_source_files_owner_index: *usize, |
| 7849 | 7889 | rc_source_files_owner_index: *usize, |
| ... | ... | @@ -7892,6 +7932,7 @@ fn handleModArg( |
| 7892 | 7932 | .inherited = mod_opts.*, |
| 7893 | 7933 | .target_arch_os_abi = target_arch_os_abi.*, |
| 7894 | 7934 | .target_mcpu = target_mcpu.*, |
| 7935 | .dynamic_linker = dynamic_linker.*, | |
| 7895 | 7936 | .deps = try deps.toOwnedSlice(arena), |
| 7896 | 7937 | .resolved = null, |
| 7897 | 7938 | .c_source_files_start = c_source_files_owner_index.*, |
| ... | ... | @@ -7903,6 +7944,7 @@ fn handleModArg( |
| 7903 | 7944 | mod_opts.* = .{}; |
| 7904 | 7945 | target_arch_os_abi.* = null; |
| 7905 | 7946 | target_mcpu.* = null; |
| 7947 | dynamic_linker.* = null; | |
| 7906 | 7948 | c_source_files_owner_index.* = create_module.c_source_files.items.len; |
| 7907 | 7949 | rc_source_files_owner_index.* = create_module.rc_source_files.items.len; |
| 7908 | 7950 | } |