| author | |
| committer | |
| log | 55ac973953da88c3a108398849ee29f797c4ae52 |
| tree | b01c6bf6a399774ec39a057b1af93f03f82453f0 |
| parent | d5d48c6f4ea8a16c2fa9dc9b083c1917a3accee0 |
It was regressed in 2 ways from the merge of #6250:
* it was not being enabled by default when the target OS is native.
* we were testing the libfoo.so file path existence with bogus format
string ('{}' instead of '{s}') and so it ended up being something
like "libstd.HashMap(K,V,...).Entry.so" instead of "libfoo.so". Using
{} rather than {s} is a footgun, be careful!
Previous functionality is now restored.
closes #65233 files changed, 10 insertions(+), 6 deletions(-)
src/Compilation.zig+1-1| ... | ... | @@ -800,7 +800,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 800 | 800 | .llvm_cpu_features = llvm_cpu_features, |
| 801 | 801 | .is_compiler_rt_or_libc = options.is_compiler_rt_or_libc, |
| 802 | 802 | .parent_compilation_link_libc = options.parent_compilation_link_libc, |
| 803 | .each_lib_rpath = options.each_lib_rpath orelse false, | |
| 803 | .each_lib_rpath = options.each_lib_rpath orelse options.is_native_os, | |
| 804 | 804 | .disable_lld_caching = options.disable_lld_caching, |
| 805 | 805 | .subsystem = options.subsystem, |
| 806 | 806 | .is_test = options.is_test, |
src/link/Elf.zig+3-2| ... | ... | @@ -1453,10 +1453,11 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1453 | 1453 | var test_path = std.ArrayList(u8).init(self.base.allocator); |
| 1454 | 1454 | defer test_path.deinit(); |
| 1455 | 1455 | for (self.base.options.lib_dirs) |lib_dir_path| { |
| 1456 | for (self.base.options.system_libs.items()) |link_lib| { | |
| 1456 | for (self.base.options.system_libs.items()) |entry| { | |
| 1457 | const link_lib = entry.key; | |
| 1457 | 1458 | test_path.shrinkRetainingCapacity(0); |
| 1458 | 1459 | const sep = fs.path.sep_str; |
| 1459 | try test_path.writer().print("{}" ++ sep ++ "lib{}.so", .{ lib_dir_path, link_lib }); | |
| 1460 | try test_path.writer().print("{s}" ++ sep ++ "lib{s}.so", .{ lib_dir_path, link_lib }); | |
| 1460 | 1461 | fs.cwd().access(test_path.items, .{}) catch |err| switch (err) { |
| 1461 | 1462 | error.FileNotFound => continue, |
| 1462 | 1463 | else => |e| return e, |
src/main.zig+6-3| ... | ... | @@ -268,10 +268,11 @@ const usage_build_generic = |
| 268 | 268 | \\ -T[script], --script [script] Use a custom linker script |
| 269 | 269 | \\ --version-script [path] Provide a version .map file |
| 270 | 270 | \\ --dynamic-linker [path] Set the dynamic interpreter path (usually ld.so) |
| 271 | \\ --each-lib-rpath Add rpath for each used dynamic library | |
| 272 | 271 | \\ --version [ver] Dynamic library semver |
| 273 | 272 | \\ -rdynamic Add all symbols to the dynamic symbol table |
| 274 | 273 | \\ -rpath [path] Add directory to the runtime library search path |
| 274 | \\ -feach-lib-rpath Ensure adding rpath for each used dynamic library | |
| 275 | \\ -fno-each-lib-rpath Prevent adding rpath for each used dynamic library | |
| 275 | 276 | \\ --eh-frame-hdr Enable C++ exception handling by passing --eh-frame-hdr to linker |
| 276 | 277 | \\ --emit-relocs Enable output of relocation sections for post build tools |
| 277 | 278 | \\ -dynamic Force output to be dynamically linked |
| ... | ... | @@ -442,7 +443,7 @@ fn buildOutputType( |
| 442 | 443 | var use_clang: ?bool = null; |
| 443 | 444 | var link_eh_frame_hdr = false; |
| 444 | 445 | var link_emit_relocs = false; |
| 445 | var each_lib_rpath = false; | |
| 446 | var each_lib_rpath: ?bool = null; | |
| 446 | 447 | var libc_paths_file: ?[]const u8 = null; |
| 447 | 448 | var machine_code_model: std.builtin.CodeModel = .default; |
| 448 | 449 | var runtime_args_start: ?usize = null; |
| ... | ... | @@ -739,8 +740,10 @@ fn buildOutputType( |
| 739 | 740 | if (i + 1 >= args.len) fatal("expected parameter after {}", .{arg}); |
| 740 | 741 | i += 1; |
| 741 | 742 | override_lib_dir = args[i]; |
| 742 | } else if (mem.eql(u8, arg, "--each-lib-rpath")) { | |
| 743 | } else if (mem.eql(u8, arg, "-feach-lib-rpath")) { | |
| 743 | 744 | each_lib_rpath = true; |
| 745 | } else if (mem.eql(u8, arg, "-fno-each-lib-rpath")) { | |
| 746 | each_lib_rpath = false; | |
| 744 | 747 | } else if (mem.eql(u8, arg, "--enable-cache")) { |
| 745 | 748 | enable_cache = true; |
| 746 | 749 | } else if (mem.eql(u8, arg, "--test-cmd-bin")) { |