| author | |
| committer | |
| log | 7c9035f63590021906de66c7490458a49afe9e0a |
| tree | af2e872aaa3856cc902f034371b1fcc44f142796 |
| parent | 55848363fd5c88bd6313880e770515a9c548c0df |
Closes #23813.4 files changed, 20 insertions(+), 10 deletions(-)
src/Compilation.zig+2| ... | ... | @@ -1351,6 +1351,7 @@ pub const cache_helpers = struct { |
| 1351 | 1351 | hh.add(target.ofmt); |
| 1352 | 1352 | hh.add(resolved_target.is_native_os); |
| 1353 | 1353 | hh.add(resolved_target.is_native_abi); |
| 1354 | hh.add(resolved_target.is_explicit_dynamic_linker); | |
| 1354 | 1355 | } |
| 1355 | 1356 | |
| 1356 | 1357 | pub fn addEmitLoc(hh: *Cache.HashHelper, emit_loc: EmitLoc) void { |
| ... | ... | @@ -4748,6 +4749,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 4748 | 4749 | |
| 4749 | 4750 | .is_native_os = false, |
| 4750 | 4751 | .is_native_abi = false, |
| 4752 | .is_explicit_dynamic_linker = false, | |
| 4751 | 4753 | }; |
| 4752 | 4754 | |
| 4753 | 4755 | const config = try Config.resolve(.{ |
src/Package/Module.zig+3| ... | ... | @@ -88,6 +88,7 @@ pub const ResolvedTarget = struct { |
| 88 | 88 | result: std.Target, |
| 89 | 89 | is_native_os: bool, |
| 90 | 90 | is_native_abi: bool, |
| 91 | is_explicit_dynamic_linker: bool, | |
| 91 | 92 | llvm_cpu_features: ?[*:0]const u8 = null, |
| 92 | 93 | }; |
| 93 | 94 | |
| ... | ... | @@ -365,6 +366,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { |
| 365 | 366 | .result = target, |
| 366 | 367 | .is_native_os = resolved_target.is_native_os, |
| 367 | 368 | .is_native_abi = resolved_target.is_native_abi, |
| 369 | .is_explicit_dynamic_linker = resolved_target.is_explicit_dynamic_linker, | |
| 368 | 370 | .llvm_cpu_features = llvm_cpu_features, |
| 369 | 371 | }, |
| 370 | 372 | .optimize_mode = optimize_mode, |
| ... | ... | @@ -441,6 +443,7 @@ pub fn createBuiltin(arena: Allocator, opts: Builtin, dirs: Compilation.Director |
| 441 | 443 | // These values are not in `opts`, but do not matter because `builtin.zig` contains no runtime code. |
| 442 | 444 | .is_native_os = false, |
| 443 | 445 | .is_native_abi = false, |
| 446 | .is_explicit_dynamic_linker = false, | |
| 444 | 447 | .llvm_cpu_features = null, |
| 445 | 448 | }, |
| 446 | 449 | .optimize_mode = opts.optimize_mode, |
src/link/Elf.zig+11-10| ... | ... | @@ -1533,8 +1533,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s |
| 1533 | 1533 | const link_mode = comp.config.link_mode; |
| 1534 | 1534 | const is_dyn_lib = link_mode == .dynamic and is_lib; |
| 1535 | 1535 | const is_exe_or_dyn_lib = is_dyn_lib or output_mode == .Exe; |
| 1536 | const have_dynamic_linker = comp.config.link_libc and | |
| 1537 | link_mode == .dynamic and is_exe_or_dyn_lib; | |
| 1536 | const have_dynamic_linker = link_mode == .dynamic and is_exe_or_dyn_lib; | |
| 1538 | 1537 | const target = self.getTarget(); |
| 1539 | 1538 | const compiler_rt_path: ?Path = blk: { |
| 1540 | 1539 | if (comp.compiler_rt_lib) |x| break :blk x.full_object_path; |
| ... | ... | @@ -1616,9 +1615,9 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s |
| 1616 | 1615 | if (comp.libc_installation) |libc_installation| { |
| 1617 | 1616 | man.hash.addBytes(libc_installation.crt_dir.?); |
| 1618 | 1617 | } |
| 1619 | if (have_dynamic_linker) { | |
| 1620 | man.hash.addOptionalBytes(target.dynamic_linker.get()); | |
| 1621 | } | |
| 1618 | } | |
| 1619 | if (have_dynamic_linker) { | |
| 1620 | man.hash.addOptionalBytes(target.dynamic_linker.get()); | |
| 1622 | 1621 | } |
| 1623 | 1622 | man.hash.addOptionalBytes(self.soname); |
| 1624 | 1623 | man.hash.addOptional(comp.version); |
| ... | ... | @@ -1908,12 +1907,14 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s |
| 1908 | 1907 | try argv.append("-L"); |
| 1909 | 1908 | try argv.append(libc_installation.crt_dir.?); |
| 1910 | 1909 | } |
| 1910 | } | |
| 1911 | 1911 | |
| 1912 | if (have_dynamic_linker) { | |
| 1913 | if (target.dynamic_linker.get()) |dynamic_linker| { | |
| 1914 | try argv.append("-dynamic-linker"); | |
| 1915 | try argv.append(dynamic_linker); | |
| 1916 | } | |
| 1912 | if (have_dynamic_linker and | |
| 1913 | (comp.config.link_libc or comp.root_mod.resolved_target.is_explicit_dynamic_linker)) | |
| 1914 | { | |
| 1915 | if (target.dynamic_linker.get()) |dynamic_linker| { | |
| 1916 | try argv.append("-dynamic-linker"); | |
| 1917 | try argv.append(dynamic_linker); | |
| 1917 | 1918 | } |
| 1918 | 1919 | } |
| 1919 | 1920 |
src/main.zig+4| ... | ... | @@ -3910,6 +3910,7 @@ fn createModule( |
| 3910 | 3910 | .result = target, |
| 3911 | 3911 | .is_native_os = target_query.isNativeOs(), |
| 3912 | 3912 | .is_native_abi = target_query.isNativeAbi(), |
| 3913 | .is_explicit_dynamic_linker = !target_query.dynamic_linker.eql(.none), | |
| 3913 | 3914 | }; |
| 3914 | 3915 | }; |
| 3915 | 3916 | |
| ... | ... | @@ -5041,6 +5042,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 5041 | 5042 | .result = std.zig.resolveTargetQueryOrFatal(target_query), |
| 5042 | 5043 | .is_native_os = false, |
| 5043 | 5044 | .is_native_abi = false, |
| 5045 | .is_explicit_dynamic_linker = false, | |
| 5044 | 5046 | }; |
| 5045 | 5047 | } |
| 5046 | 5048 | } |
| ... | ... | @@ -5048,6 +5050,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 5048 | 5050 | .result = std.zig.resolveTargetQueryOrFatal(.{}), |
| 5049 | 5051 | .is_native_os = true, |
| 5050 | 5052 | .is_native_abi = true, |
| 5053 | .is_explicit_dynamic_linker = false, | |
| 5051 | 5054 | }; |
| 5052 | 5055 | }; |
| 5053 | 5056 | |
| ... | ... | @@ -5465,6 +5468,7 @@ fn jitCmd( |
| 5465 | 5468 | .result = std.zig.resolveTargetQueryOrFatal(target_query), |
| 5466 | 5469 | .is_native_os = true, |
| 5467 | 5470 | .is_native_abi = true, |
| 5471 | .is_explicit_dynamic_linker = false, | |
| 5468 | 5472 | }; |
| 5469 | 5473 | |
| 5470 | 5474 | const exe_basename = try std.zig.binNameAlloc(arena, .{ |