| ... | ... | @@ -1318,15 +1318,8 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node |
| 1318 | 1318 | defer test_path.deinit(); |
| 1319 | 1319 | for (self.base.options.lib_dirs) |lib_dir_path| { |
| 1320 | 1320 | for (self.base.options.system_libs.keys()) |link_lib| { |
| 1321 | | test_path.clearRetainingCapacity(); |
| 1322 | | const sep = fs.path.sep_str; |
| 1323 | | try test_path.writer().print("{s}" ++ sep ++ "lib{s}.so", .{ |
| 1324 | | lib_dir_path, link_lib, |
| 1325 | | }); |
| 1326 | | fs.cwd().access(test_path.items, .{}) catch |err| switch (err) { |
| 1327 | | error.FileNotFound => continue, |
| 1328 | | else => |e| return e, |
| 1329 | | }; |
| 1321 | if (!(try self.accessLibPath(&test_path, null, lib_dir_path, link_lib, .Dynamic))) |
| 1322 | continue; |
| 1330 | 1323 | _ = try rpath_table.put(lib_dir_path, {}); |
| 1331 | 1324 | } |
| 1332 | 1325 | } |
| ... | ... | @@ -1892,7 +1885,7 @@ fn parseLdScript(self: *Elf, in_file: std.fs.File, lib: SystemLib, ctx: *ParseEr |
| 1892 | 1885 | fn accessLibPath( |
| 1893 | 1886 | self: *Elf, |
| 1894 | 1887 | test_path: *std.ArrayList(u8), |
| 1895 | | checked_paths: *std.ArrayList([]const u8), |
| 1888 | checked_paths: ?*std.ArrayList([]const u8), |
| 1896 | 1889 | lib_dir_path: []const u8, |
| 1897 | 1890 | lib_name: []const u8, |
| 1898 | 1891 | link_mode: ?std.builtin.LinkMode, |
| ... | ... | @@ -1909,7 +1902,9 @@ fn accessLibPath( |
| 1909 | 1902 | .Dynamic => target.dynamicLibSuffix(), |
| 1910 | 1903 | } else "", |
| 1911 | 1904 | }); |
| 1912 | | try checked_paths.append(try self.base.allocator.dupe(u8, test_path.items)); |
| 1905 | if (checked_paths) |cpaths| { |
| 1906 | try cpaths.append(try self.base.allocator.dupe(u8, test_path.items)); |
| 1907 | } |
| 1913 | 1908 | fs.cwd().access(test_path.items, .{}) catch |err| switch (err) { |
| 1914 | 1909 | error.FileNotFound => return false, |
| 1915 | 1910 | else => |e| return e, |
| ... | ... | @@ -2543,19 +2538,11 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v |
| 2543 | 2538 | } |
| 2544 | 2539 | |
| 2545 | 2540 | if (self.base.options.each_lib_rpath) { |
| 2546 | | var test_path = std.ArrayList(u8).init(self.base.allocator); |
| 2547 | | defer test_path.deinit(); |
| 2541 | var test_path = std.ArrayList(u8).init(arena); |
| 2548 | 2542 | for (self.base.options.lib_dirs) |lib_dir_path| { |
| 2549 | 2543 | for (self.base.options.system_libs.keys()) |link_lib| { |
| 2550 | | test_path.clearRetainingCapacity(); |
| 2551 | | const sep = fs.path.sep_str; |
| 2552 | | try test_path.writer().print("{s}" ++ sep ++ "lib{s}.so", .{ |
| 2553 | | lib_dir_path, link_lib, |
| 2554 | | }); |
| 2555 | | fs.cwd().access(test_path.items, .{}) catch |err| switch (err) { |
| 2556 | | error.FileNotFound => continue, |
| 2557 | | else => |e| return e, |
| 2558 | | }; |
| 2544 | if (!(try self.accessLibPath(&test_path, null, lib_dir_path, link_lib, .Dynamic))) |
| 2545 | continue; |
| 2559 | 2546 | if ((try rpath_table.fetchPut(lib_dir_path, {})) == null) { |
| 2560 | 2547 | try argv.append("-rpath"); |
| 2561 | 2548 | try argv.append(lib_dir_path); |