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