authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-11-06 10:58:49+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-11-06 11:34:51+01:00
logb7c3ebcb9e3aefbdd82a43c7ab122931787c7805
tree4136470a9950065a63e77f5ef61d93e2b3b0f93f
parente0e3ceac19c0de0f8b3e408f9d3728496bc051f7

Rely on ZIG_SYSTEM_LINKER_HACK instead of input flags


9 files changed, 74 insertions(+), 122 deletions(-)

CMakeLists.txt+7-18
...@@ -505,24 +505,13 @@ add_dependencies(zig zig_build_zig1)...@@ -505,24 +505,13 @@ add_dependencies(zig zig_build_zig1)
505505
506install(TARGETS zig DESTINATION bin)506install(TARGETS zig DESTINATION bin)
507507
508if(NOT SYSTEM_LINKER_HACK)508set(ZIG_INSTALL_ARGS "build"
509 set(ZIG_INSTALL_ARGS "build"509 --override-lib-dir "${CMAKE_SOURCE_DIR}/lib"
510 --override-lib-dir "${CMAKE_SOURCE_DIR}/lib"510 "-Dlib-files-only"
511 "-Dlib-files-only"511 --prefix "${CMAKE_INSTALL_PREFIX}"
512 --prefix "${CMAKE_INSTALL_PREFIX}"512 "-Dconfig_h=${ZIG_CONFIG_H_OUT}"
513 "-Dconfig_h=${ZIG_CONFIG_H_OUT}"513 install
514 install514)
515 )
516else()
517 set(ZIG_INSTALL_ARGS "build"
518 --override-lib-dir "${CMAKE_SOURCE_DIR}/lib"
519 "-Dlib-files-only"
520 --prefix "${CMAKE_INSTALL_PREFIX}"
521 "-Dconfig_h=${ZIG_CONFIG_H_OUT}"
522 --system-linker-hack
523 install
524 )
525endif()
526515
527# CODE has no effect with Visual Studio build system generator, therefore516# CODE has no effect with Visual Studio build system generator, therefore
528# when using Visual Studio build system generator we resort to running517# when using Visual Studio build system generator we resort to running
build.zig+1-1
...@@ -396,8 +396,8 @@ fn configureStage2(b: *Builder, exe: anytype, ctx: Context, need_cpp_includes: b...@@ -396,8 +396,8 @@ fn configureStage2(b: *Builder, exe: anytype, ctx: Context, need_cpp_includes: b
396 try addCxxKnownPath(b, ctx, exe, "libstdc++.a", null, need_cpp_includes);396 try addCxxKnownPath(b, ctx, exe, "libstdc++.a", null, need_cpp_includes);
397 exe.linkSystemLibrary("pthread");397 exe.linkSystemLibrary("pthread");
398 // TODO LLD cannot perform this link.398 // TODO LLD cannot perform this link.
399 // Set ZIG_SYSTEM_LINKER_HACK env var to use system linker ld instead.
399 // See https://github.com/ziglang/zig/issues/1535400 // See https://github.com/ziglang/zig/issues/1535
400 exe.enableSystemLinkerHack();
401 } else |err| switch (err) {401 } else |err| switch (err) {
402 error.RequiredLibraryNotFound => {402 error.RequiredLibraryNotFound => {
403 // System compiler, not gcc.403 // System compiler, not gcc.
lib/std/build.zig-8
...@@ -67,7 +67,6 @@ pub const Builder = struct {...@@ -67,7 +67,6 @@ pub const Builder = struct {
67 vcpkg_root: VcpkgRoot,67 vcpkg_root: VcpkgRoot,
68 pkg_config_pkg_list: ?(PkgConfigError![]const PkgConfigPkg) = null,68 pkg_config_pkg_list: ?(PkgConfigError![]const PkgConfigPkg) = null,
69 args: ?[][]const u8 = null,69 args: ?[][]const u8 = null,
70 system_linker_hack: bool,
7170
72 const PkgConfigError = error{71 const PkgConfigError = error{
73 PkgConfigCrashed,72 PkgConfigCrashed,
...@@ -174,7 +173,6 @@ pub const Builder = struct {...@@ -174,7 +173,6 @@ pub const Builder = struct {
174 .install_path = undefined,173 .install_path = undefined,
175 .vcpkg_root = VcpkgRoot{ .Unattempted = {} },174 .vcpkg_root = VcpkgRoot{ .Unattempted = {} },
176 .args = null,175 .args = null,
177 .system_linker_hack = false,
178 };176 };
179 try self.top_level_steps.append(&self.install_tls);177 try self.top_level_steps.append(&self.install_tls);
180 try self.top_level_steps.append(&self.uninstall_tls);178 try self.top_level_steps.append(&self.uninstall_tls);
...@@ -1239,7 +1237,6 @@ pub const LibExeObjStep = struct {...@@ -1239,7 +1237,6 @@ pub const LibExeObjStep = struct {
1239 packages: ArrayList(Pkg),1237 packages: ArrayList(Pkg),
1240 build_options_contents: std.ArrayList(u8),1238 build_options_contents: std.ArrayList(u8),
1241 build_options_artifact_args: std.ArrayList(BuildOptionArtifactArg),1239 build_options_artifact_args: std.ArrayList(BuildOptionArtifactArg),
1242 system_linker_hack: bool = false,
12431240
1244 object_src: []const u8,1241 object_src: []const u8,
12451242
...@@ -1900,10 +1897,6 @@ pub const LibExeObjStep = struct {...@@ -1900,10 +1897,6 @@ pub const LibExeObjStep = struct {
1900 self.exec_cmd_args = args;1897 self.exec_cmd_args = args;
1901 }1898 }
19021899
1903 pub fn enableSystemLinkerHack(self: *LibExeObjStep) void {
1904 self.system_linker_hack = true;
1905 }
1906
1907 fn linkLibraryOrObject(self: *LibExeObjStep, other: *LibExeObjStep) void {1900 fn linkLibraryOrObject(self: *LibExeObjStep, other: *LibExeObjStep) void {
1908 self.step.dependOn(&other.step);1901 self.step.dependOn(&other.step);
1909 self.link_objects.append(LinkObject{ .OtherStep = other }) catch unreachable;1902 self.link_objects.append(LinkObject{ .OtherStep = other }) catch unreachable;
...@@ -2076,7 +2069,6 @@ pub const LibExeObjStep = struct {...@@ -2076,7 +2069,6 @@ pub const LibExeObjStep = struct {
2076 if (builder.verbose_link or self.verbose_link) zig_args.append("--verbose-link") catch unreachable;2069 if (builder.verbose_link or self.verbose_link) zig_args.append("--verbose-link") catch unreachable;
2077 if (builder.verbose_cc or self.verbose_cc) zig_args.append("--verbose-cc") catch unreachable;2070 if (builder.verbose_cc or self.verbose_cc) zig_args.append("--verbose-cc") catch unreachable;
2078 if (builder.verbose_llvm_cpu_features) zig_args.append("--verbose-llvm-cpu-features") catch unreachable;2071 if (builder.verbose_llvm_cpu_features) zig_args.append("--verbose-llvm-cpu-features") catch unreachable;
2079 if (builder.system_linker_hack or self.system_linker_hack) zig_args.append("--system-linker-hack") catch unreachable;
20802072
2081 if (self.emit_llvm_ir) try zig_args.append("-femit-llvm-ir");2073 if (self.emit_llvm_ir) try zig_args.append("-femit-llvm-ir");
2082 if (self.emit_asm) try zig_args.append("-femit-asm");2074 if (self.emit_asm) try zig_args.append("-femit-asm");
lib/std/special/build_runner.zig-3
...@@ -112,8 +112,6 @@ pub fn main() !void {...@@ -112,8 +112,6 @@ pub fn main() !void {
112 builder.verbose_cc = true;112 builder.verbose_cc = true;
113 } else if (mem.eql(u8, arg, "--verbose-llvm-cpu-features")) {113 } else if (mem.eql(u8, arg, "--verbose-llvm-cpu-features")) {
114 builder.verbose_llvm_cpu_features = true;114 builder.verbose_llvm_cpu_features = true;
115 } else if (mem.eql(u8, arg, "--system-linker-hack")) {
116 builder.system_linker_hack = true;
117 } else if (mem.eql(u8, arg, "--")) {115 } else if (mem.eql(u8, arg, "--")) {
118 builder.args = argsRest(args, arg_idx);116 builder.args = argsRest(args, arg_idx);
119 break;117 break;
...@@ -215,7 +213,6 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void...@@ -215,7 +213,6 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
215 \\ --verbose-cimport Enable compiler debug output for C imports213 \\ --verbose-cimport Enable compiler debug output for C imports
216 \\ --verbose-cc Enable compiler debug output for C compilation214 \\ --verbose-cc Enable compiler debug output for C compilation
217 \\ --verbose-llvm-cpu-features Enable compiler debug output for LLVM CPU features215 \\ --verbose-llvm-cpu-features Enable compiler debug output for LLVM CPU features
218 \\ --system-linker-hack Use system linker LD instead of LLD (requires LLVM enabled)
219 \\216 \\
220 );217 );
221}218}
src/Compilation.zig+18-11
...@@ -348,8 +348,6 @@ pub const InitOptions = struct {...@@ -348,8 +348,6 @@ pub const InitOptions = struct {
348 want_valgrind: ?bool = null,348 want_valgrind: ?bool = null,
349 use_llvm: ?bool = null,349 use_llvm: ?bool = null,
350 use_lld: ?bool = null,350 use_lld: ?bool = null,
351 /// When set, this option will overwrite LLD with the system linker LD.
352 system_linker_hack: bool = false,
353 use_clang: ?bool = null,351 use_clang: ?bool = null,
354 rdynamic: bool = false,352 rdynamic: bool = false,
355 strip: bool = false,353 strip: bool = false,
...@@ -474,13 +472,22 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {...@@ -474,13 +472,22 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
474 break :blk false;472 break :blk false;
475 };473 };
476474
477 const syslibroot = if (build_options.have_llvm and comptime std.Target.current.isDarwin()) outer: {475 const DarwinOptions = struct {
478 const path = if (use_lld and options.is_native_os and options.target.isDarwin()) inner: {476 syslibroot: ?[]const u8 = null,
479 const syslibroot_path = try std.zig.system.getSDKPath(arena);477 system_linker_hack: bool = false,
480 break :inner syslibroot_path;478 };
481 } else null;479
482 break :outer path;480 const darwin_options: DarwinOptions = if (build_options.have_llvm and comptime std.Target.current.isDarwin()) outer: {
483 } else null;481 const opts: DarwinOptions = if (use_lld and options.is_native_os and options.target.isDarwin()) inner: {
482 const syslibroot = try std.zig.system.getSDKPath(arena);
483 const system_linker_hack = if (std.os.getenv("ZIG_SYSTEM_LINKER_HACK")) |_| true else false;
484 break :inner .{
485 .syslibroot = syslibroot,
486 .system_linker_hack = system_linker_hack,
487 };
488 } else .{};
489 break :outer opts;
490 } else .{};
484491
485 const link_libc = options.link_libc or target_util.osRequiresLibC(options.target);492 const link_libc = options.link_libc or target_util.osRequiresLibC(options.target);
486493
...@@ -777,14 +784,14 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {...@@ -777,14 +784,14 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
777 .optimize_mode = options.optimize_mode,784 .optimize_mode = options.optimize_mode,
778 .use_lld = use_lld,785 .use_lld = use_lld,
779 .use_llvm = use_llvm,786 .use_llvm = use_llvm,
780 .system_linker_hack = options.system_linker_hack,787 .system_linker_hack = darwin_options.system_linker_hack,
781 .link_libc = link_libc,788 .link_libc = link_libc,
782 .link_libcpp = options.link_libcpp,789 .link_libcpp = options.link_libcpp,
783 .objects = options.link_objects,790 .objects = options.link_objects,
784 .frameworks = options.frameworks,791 .frameworks = options.frameworks,
785 .framework_dirs = options.framework_dirs,792 .framework_dirs = options.framework_dirs,
786 .system_libs = system_libs,793 .system_libs = system_libs,
787 .syslibroot = syslibroot,794 .syslibroot = darwin_options.syslibroot,
788 .lib_dirs = options.lib_dirs,795 .lib_dirs = options.lib_dirs,
789 .rpath_list = options.rpath_list,796 .rpath_list = options.rpath_list,
790 .strip = strip,797 .strip = strip,
src/link.zig+2-2
...@@ -57,8 +57,8 @@ pub const Options = struct {...@@ -57,8 +57,8 @@ pub const Options = struct {
57 /// other objects.57 /// other objects.
58 /// Otherwise (depending on `use_lld`) this link code directly outputs and updates the final binary.58 /// Otherwise (depending on `use_lld`) this link code directly outputs and updates the final binary.
59 use_llvm: bool,59 use_llvm: bool,
60 /// If this is true and `use_llvm` is true, this link code will use system linker `ld` instead of 60 /// Darwin-only. If this is true, `use_llvm` is true, and `is_native_os` is true, this link code will
61 /// the LLD.61 /// use system linker `ld` instead of the LLD.
62 system_linker_hack: bool,62 system_linker_hack: bool,
63 link_libc: bool,63 link_libc: bool,
64 link_libcpp: bool,64 link_libcpp: bool,
src/link/Elf.zig+40-66
...@@ -1353,20 +1353,14 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {...@@ -1353,20 +1353,14 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
1353 // Create an LLD command line and invoke it.1353 // Create an LLD command line and invoke it.
1354 var argv = std.ArrayList([]const u8).init(self.base.allocator);1354 var argv = std.ArrayList([]const u8).init(self.base.allocator);
1355 defer argv.deinit();1355 defer argv.deinit();
13561356 // Even though we're calling LLD as a library it thinks the first argument is its own exe name.
1357 if (self.base.options.is_native_os and self.base.options.system_linker_hack) {1357 try argv.append("lld");
1358 try argv.append("ld");
1359 } else {
1360 // Even though we're calling LLD as a library it thinks the first argument is its own exe name.
1361 try argv.append("lld");
1362
1363 try argv.append("-error-limit=0");
1364 }
1365
1366 if (is_obj) {1358 if (is_obj) {
1367 try argv.append("-r");1359 try argv.append("-r");
1368 }1360 }
13691361
1362 try argv.append("-error-limit=0");
1363
1370 if (self.base.options.output_mode == .Exe) {1364 if (self.base.options.output_mode == .Exe) {
1371 try argv.append("-z");1365 try argv.append("-z");
1372 try argv.append(try std.fmt.allocPrint(arena, "stack-size={}", .{stack_size}));1366 try argv.append(try std.fmt.allocPrint(arena, "stack-size={}", .{stack_size}));
...@@ -1622,63 +1616,43 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {...@@ -1622,63 +1616,43 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
1622 Compilation.dump_argv(argv.items);1616 Compilation.dump_argv(argv.items);
1623 }1617 }
16241618
1625 if (self.base.options.is_native_os and self.base.options.system_linker_hack) {1619 // Oh, snapplesauce! We need null terminated argv.
1626 const result = try std.ChildProcess.exec(.{ .allocator = self.base.allocator, .argv = argv.items });1620 const new_argv = try arena.allocSentinel(?[*:0]const u8, argv.items.len, null);
1627 defer {1621 for (argv.items) |arg, i| {
1628 self.base.allocator.free(result.stdout);1622 new_argv[i] = try arena.dupeZ(u8, arg);
1629 self.base.allocator.free(result.stderr);1623 }
1630 }
1631 if (result.stdout.len != 0) {
1632 std.log.warn("unexpected LD stdout: {}", .{result.stdout});
1633 }
1634 if (result.stderr.len != 0) {
1635 std.log.warn("unexpected LD stderr: {}", .{result.stderr});
1636 }
1637 if (result.term.Exited != 0) {
1638 // TODO parse this output and surface with the Compilation API rather than
1639 // directly outputting to stderr here.
1640 std.debug.print("{}", .{result.stderr});
1641 return error.LDReportedFailure;
1642 }
1643 } else {
1644 // Oh, snapplesauce! We need null terminated argv.
1645 const new_argv = try arena.allocSentinel(?[*:0]const u8, argv.items.len, null);
1646 for (argv.items) |arg, i| {
1647 new_argv[i] = try arena.dupeZ(u8, arg);
1648 }
16491624
1650 var stderr_context: LLDContext = .{1625 var stderr_context: LLDContext = .{
1651 .elf = self,1626 .elf = self,
1652 .data = std.ArrayList(u8).init(self.base.allocator),1627 .data = std.ArrayList(u8).init(self.base.allocator),
1653 };1628 };
1654 defer stderr_context.data.deinit();1629 defer stderr_context.data.deinit();
1655 var stdout_context: LLDContext = .{1630 var stdout_context: LLDContext = .{
1656 .elf = self,1631 .elf = self,
1657 .data = std.ArrayList(u8).init(self.base.allocator),1632 .data = std.ArrayList(u8).init(self.base.allocator),
1658 };1633 };
1659 defer stdout_context.data.deinit();1634 defer stdout_context.data.deinit();
1660 const llvm = @import("../llvm.zig");1635 const llvm = @import("../llvm.zig");
1661 const ok = llvm.Link(1636 const ok = llvm.Link(
1662 .ELF,1637 .ELF,
1663 new_argv.ptr,1638 new_argv.ptr,
1664 new_argv.len,1639 new_argv.len,
1665 append_diagnostic,1640 append_diagnostic,
1666 @ptrToInt(&stdout_context),1641 @ptrToInt(&stdout_context),
1667 @ptrToInt(&stderr_context),1642 @ptrToInt(&stderr_context),
1668 );1643 );
1669 if (stderr_context.oom or stdout_context.oom) return error.OutOfMemory;1644 if (stderr_context.oom or stdout_context.oom) return error.OutOfMemory;
1670 if (stdout_context.data.items.len != 0) {1645 if (stdout_context.data.items.len != 0) {
1671 std.log.warn("unexpected LLD stdout: {}", .{stdout_context.data.items});1646 std.log.warn("unexpected LLD stdout: {}", .{stdout_context.data.items});
1672 }1647 }
1673 if (!ok) {1648 if (!ok) {
1674 // TODO parse this output and surface with the Compilation API rather than1649 // TODO parse this output and surface with the Compilation API rather than
1675 // directly outputting to stderr here.1650 // directly outputting to stderr here.
1676 std.debug.print("{}", .{stderr_context.data.items});1651 std.debug.print("{}", .{stderr_context.data.items});
1677 return error.LLDReportedFailure;1652 return error.LLDReportedFailure;
1678 }1653 }
1679 if (stderr_context.data.items.len != 0) {1654 if (stderr_context.data.items.len != 0) {
1680 std.log.warn("unexpected LLD stderr: {}", .{stderr_context.data.items});1655 std.log.warn("unexpected LLD stderr: {}", .{stderr_context.data.items});
1681 }
1682 }1656 }
16831657
1684 if (!self.base.options.disable_lld_caching) {1658 if (!self.base.options.disable_lld_caching) {
src/link/MachO.zig+6-2
...@@ -534,7 +534,9 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {...@@ -534,7 +534,9 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
534 defer argv.deinit();534 defer argv.deinit();
535535
536 // TODO https://github.com/ziglang/zig/issues/6971536 // TODO https://github.com/ziglang/zig/issues/6971
537 if (self.base.options.is_native_os and self.base.options.system_linker_hack) {537 // Note that there is no need to check if running natively since we do that already
538 // when setting `system_linker_hack` in Compilation struct.
539 if (self.base.options.system_linker_hack) {
538 try argv.append("ld");540 try argv.append("ld");
539 } else {541 } else {
540 // Even though we're calling LLD as a library it thinks the first argument is its own exe name.542 // Even though we're calling LLD as a library it thinks the first argument is its own exe name.
...@@ -710,7 +712,9 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {...@@ -710,7 +712,9 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
710 }712 }
711713
712 // TODO https://github.com/ziglang/zig/issues/6971714 // TODO https://github.com/ziglang/zig/issues/6971
713 if (self.base.options.is_native_os and self.base.options.system_linker_hack) {715 // Note that there is no need to check if running natively since we do that already
716 // when setting `system_linker_hack` in Compilation struct.
717 if (self.base.options.system_linker_hack) {
714 const result = try std.ChildProcess.exec(.{ .allocator = self.base.allocator, .argv = argv.items });718 const result = try std.ChildProcess.exec(.{ .allocator = self.base.allocator, .argv = argv.items });
715 defer {719 defer {
716 self.base.allocator.free(result.stdout);720 self.base.allocator.free(result.stdout);
src/main.zig-11
...@@ -317,7 +317,6 @@ const usage_build_generic =...@@ -317,7 +317,6 @@ const usage_build_generic =
317 \\ --image-base [addr] Set base address for executable image317 \\ --image-base [addr] Set base address for executable image
318 \\ -framework [name] (darwin) link against framework318 \\ -framework [name] (darwin) link against framework
319 \\ -F[dir] (darwin) add search path for frameworks319 \\ -F[dir] (darwin) add search path for frameworks
320 \\ --system-linker-hack Use system linker LD instead of LLD (requires LLVM enabled)
321 \\320 \\
322 \\Test Options:321 \\Test Options:
323 \\ --test-filter [text] Skip tests that do not match filter322 \\ --test-filter [text] Skip tests that do not match filter
...@@ -475,7 +474,6 @@ fn buildOutputType(...@@ -475,7 +474,6 @@ fn buildOutputType(
475 var image_base_override: ?u64 = null;474 var image_base_override: ?u64 = null;
476 var use_llvm: ?bool = null;475 var use_llvm: ?bool = null;
477 var use_lld: ?bool = null;476 var use_lld: ?bool = null;
478 var system_linker_hack = false;
479 var use_clang: ?bool = null;477 var use_clang: ?bool = null;
480 var link_eh_frame_hdr = false;478 var link_eh_frame_hdr = false;
481 var link_emit_relocs = false;479 var link_emit_relocs = false;
...@@ -917,8 +915,6 @@ fn buildOutputType(...@@ -917,8 +915,6 @@ fn buildOutputType(
917 mem.startsWith(u8, arg, "-I"))915 mem.startsWith(u8, arg, "-I"))
918 {916 {
919 try clang_argv.append(arg);917 try clang_argv.append(arg);
920 } else if (mem.startsWith(u8, arg, "--system-linker-hack")) {
921 system_linker_hack = true;
922 } else {918 } else {
923 fatal("unrecognized parameter: '{}'", .{arg});919 fatal("unrecognized parameter: '{}'", .{arg});
924 }920 }
...@@ -1643,7 +1639,6 @@ fn buildOutputType(...@@ -1643,7 +1639,6 @@ fn buildOutputType(
1643 .want_valgrind = want_valgrind,1639 .want_valgrind = want_valgrind,
1644 .use_llvm = use_llvm,1640 .use_llvm = use_llvm,
1645 .use_lld = use_lld,1641 .use_lld = use_lld,
1646 .system_linker_hack = system_linker_hack,
1647 .use_clang = use_clang,1642 .use_clang = use_clang,
1648 .rdynamic = rdynamic,1643 .rdynamic = rdynamic,
1649 .linker_script = linker_script,1644 .linker_script = linker_script,
...@@ -2165,7 +2160,6 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v...@@ -2165,7 +2160,6 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
2165 var override_global_cache_dir: ?[]const u8 = null;2160 var override_global_cache_dir: ?[]const u8 = null;
2166 var override_local_cache_dir: ?[]const u8 = null;2161 var override_local_cache_dir: ?[]const u8 = null;
2167 var child_argv = std.ArrayList([]const u8).init(arena);2162 var child_argv = std.ArrayList([]const u8).init(arena);
2168 var system_linker_hack = false;
21692163
2170 const argv_index_exe = child_argv.items.len;2164 const argv_index_exe = child_argv.items.len;
2171 _ = try child_argv.addOne();2165 _ = try child_argv.addOne();
...@@ -2206,10 +2200,6 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v...@@ -2206,10 +2200,6 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
2206 override_global_cache_dir = args[i];2200 override_global_cache_dir = args[i];
2207 try child_argv.appendSlice(&[_][]const u8{ arg, args[i] });2201 try child_argv.appendSlice(&[_][]const u8{ arg, args[i] });
2208 continue;2202 continue;
2209 } else if (mem.eql(u8, arg, "--system-linker-hack")) {
2210 system_linker_hack = true;
2211 try child_argv.append(arg);
2212 continue;
2213 }2203 }
2214 }2204 }
2215 try child_argv.append(arg);2205 try child_argv.append(arg);
...@@ -2345,7 +2335,6 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v...@@ -2345,7 +2335,6 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
2345 .optimize_mode = .Debug,2335 .optimize_mode = .Debug,
2346 .self_exe_path = self_exe_path,2336 .self_exe_path = self_exe_path,
2347 .rand = &default_prng.random,2337 .rand = &default_prng.random,
2348 .system_linker_hack = system_linker_hack,
2349 }) catch |err| {2338 }) catch |err| {
2350 fatal("unable to create compilation: {}", .{@errorName(err)});2339 fatal("unable to create compilation: {}", .{@errorName(err)});
2351 };2340 };