diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-29 14:18:32 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-29 14:18:32 -0700 |
| commit | 3cf8f283d3f271b6d0b5de39f55e4ea40b83eece (patch) | |
| tree | 473271314571f59d4e0c0154acf078d1445b5fdb /src/link | |
| parent | 4fc2acdaa4f2b649b17ddf958d2608abc4787a4e (diff) | |
| parent | 58540f968a2ae53b4b1ff5a917fdb404088a222a (diff) | |
| download | zig-3cf8f283d3f271b6d0b5de39f55e4ea40b83eece.tar.gz zig-3cf8f283d3f271b6d0b5de39f55e4ea40b83eece.zip | |
Merge pull request #12085 from topolarity/dyn-link-libcpp
Dynamically link `libc++` if integrating with system LLVM
Diffstat (limited to 'src/link')
| -rw-r--r-- | src/link/Elf.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 3e9b1ab3ed..917e4c18d1 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -1592,6 +1592,15 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v } } } + for (self.base.options.objects) |obj| { + if (Compilation.classifyFileExt(obj.path) == .shared_library) { + const lib_dir_path = std.fs.path.dirname(obj.path).?; + if ((try rpath_table.fetchPut(lib_dir_path, {})) == null) { + try argv.append("-rpath"); + try argv.append(lib_dir_path); + } + } + } } for (self.base.options.lib_dirs) |lib_dir| { |
