authorgravatar for topolarity@tapscott.meCody Tapscott <topolarity@tapscott.me> 2022-07-28 22:16:59-07:00
committergravatar for cody+topolarity@tapscott.meCody Tapscott <cody+topolarity@tapscott.me> 2022-07-29 09:44:45-07:00
log58540f968a2ae53b4b1ff5a917fdb404088a222a
tree12787c37ee965e2bbed7ea51fec0f747bdf42962
parentf1feb1369b128fb515a369b1144574b4c1b53b6e

ELF: Scan for dylibs-as-objects when adding rpaths

Shared libraries can be provided on the command line as if they were objects, as a path to the ".so" file. The "each-lib-rpath" functionality was ignoring these shared libraries accidentally, causing missing rpaths in the output executable.

1 files changed, 9 insertions(+), 0 deletions(-)

src/link/Elf.zig+9
...@@ -1592,6 +1592,15 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v...@@ -1592,6 +1592,15 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v
1592 }1592 }
1593 }1593 }
1594 }1594 }
1595 for (self.base.options.objects) |obj| {
1596 if (Compilation.classifyFileExt(obj.path) == .shared_library) {
1597 const lib_dir_path = std.fs.path.dirname(obj.path).?;
1598 if ((try rpath_table.fetchPut(lib_dir_path, {})) == null) {
1599 try argv.append("-rpath");
1600 try argv.append(lib_dir_path);
1601 }
1602 }
1603 }
1595 }1604 }
15961605
1597 for (self.base.options.lib_dirs) |lib_dir| {1606 for (self.base.options.lib_dirs) |lib_dir| {