| ... | @@ -236,7 +236,7 @@ pub fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi | ... | @@ -236,7 +236,7 @@ pub fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi |
| 236 | mem.eql(u8, cmd, "lld-link") or | 236 | mem.eql(u8, cmd, "lld-link") or |
| 237 | mem.eql(u8, cmd, "wasm-ld")) | 237 | mem.eql(u8, cmd, "wasm-ld")) |
| 238 | { | 238 | { |
| 239 | return process.exit(try lldMain(arena, args)); | 239 | return process.exit(try lldMain(arena, args, true)); |
| 240 | } else if (mem.eql(u8, cmd, "build")) { | 240 | } else if (mem.eql(u8, cmd, "build")) { |
| 241 | return cmdBuild(gpa, arena, cmd_args); | 241 | return cmdBuild(gpa, arena, cmd_args); |
| 242 | } else if (mem.eql(u8, cmd, "fmt")) { | 242 | } else if (mem.eql(u8, cmd, "fmt")) { |
| ... | @@ -4119,7 +4119,11 @@ pub fn llvmArMain(alloc: Allocator, args: []const []const u8) error{OutOfMemory} | ... | @@ -4119,7 +4119,11 @@ pub fn llvmArMain(alloc: Allocator, args: []const []const u8) error{OutOfMemory} |
| 4119 | /// * `ld.lld` - ELF | 4119 | /// * `ld.lld` - ELF |
| 4120 | /// * `lld-link` - COFF | 4120 | /// * `lld-link` - COFF |
| 4121 | /// * `wasm-ld` - WebAssembly | 4121 | /// * `wasm-ld` - WebAssembly |
| 4122 | pub fn lldMain(alloc: Allocator, args: []const []const u8) error{OutOfMemory}!u8 { | 4122 | pub fn lldMain( |
| | 4123 | alloc: Allocator, |
| | 4124 | args: []const []const u8, |
| | 4125 | can_exit_early: bool, |
| | 4126 | ) error{OutOfMemory}!u8 { |
| 4123 | if (!build_options.have_llvm) | 4127 | if (!build_options.have_llvm) |
| 4124 | fatal("`zig {s}` unavailable: compiler built without LLVM extensions", .{args[0]}); | 4128 | fatal("`zig {s}` unavailable: compiler built without LLVM extensions", .{args[0]}); |
| 4125 | | 4129 | |
| ... | @@ -4130,7 +4134,7 @@ pub fn lldMain(alloc: Allocator, args: []const []const u8) error{OutOfMemory}!u8 | ... | @@ -4130,7 +4134,7 @@ pub fn lldMain(alloc: Allocator, args: []const []const u8) error{OutOfMemory}!u8 |
| 4130 | var count: usize = 0; | 4134 | var count: usize = 0; |
| 4131 | }; | 4135 | }; |
| 4132 | if (CallCounter.count == 1) { // Issue the warning on the first repeat call | 4136 | if (CallCounter.count == 1) { // Issue the warning on the first repeat call |
| 4133 | warn("calling lldMain repeatedly within the same process can have side effects (https://github.com/ziglang/zig/issues/3825)", .{}); | 4137 | warn("invoking LLD for the second time within the same process because the host OS ({s}) does not support spawning child processes. This sometimes activates LLD bugs", .{@tagName(builtin.os.tag)}); |
| 4134 | } | 4138 | } |
| 4135 | CallCounter.count += 1; | 4139 | CallCounter.count += 1; |
| 4136 | | 4140 | |
| ... | @@ -4145,11 +4149,11 @@ pub fn lldMain(alloc: Allocator, args: []const []const u8) error{OutOfMemory}!u8 | ... | @@ -4145,11 +4149,11 @@ pub fn lldMain(alloc: Allocator, args: []const []const u8) error{OutOfMemory}!u8 |
| 4145 | const llvm = @import("codegen/llvm/bindings.zig"); | 4149 | const llvm = @import("codegen/llvm/bindings.zig"); |
| 4146 | const argc = @intCast(c_int, argv.len); | 4150 | const argc = @intCast(c_int, argv.len); |
| 4147 | if (mem.eql(u8, args[1], "ld.lld")) { | 4151 | if (mem.eql(u8, args[1], "ld.lld")) { |
| 4148 | break :rc llvm.LinkELF(argc, argv.ptr, true); | 4152 | break :rc llvm.LinkELF(argc, argv.ptr, can_exit_early); |
| 4149 | } else if (mem.eql(u8, args[1], "lld-link")) { | 4153 | } else if (mem.eql(u8, args[1], "lld-link")) { |
| 4150 | break :rc llvm.LinkCOFF(argc, argv.ptr, true); | 4154 | break :rc llvm.LinkCOFF(argc, argv.ptr, can_exit_early); |
| 4151 | } else if (mem.eql(u8, args[1], "wasm-ld")) { | 4155 | } else if (mem.eql(u8, args[1], "wasm-ld")) { |
| 4152 | break :rc llvm.LinkWasm(argc, argv.ptr, true); | 4156 | break :rc llvm.LinkWasm(argc, argv.ptr, can_exit_early); |
| 4153 | } else { | 4157 | } else { |
| 4154 | unreachable; | 4158 | unreachable; |
| 4155 | } | 4159 | } |