aboutsummaryrefslogtreecommitdiff
path: root/src/link/Elf.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-08-03 09:53:18 -0700
committerGitHub <noreply@github.com>2023-08-03 09:53:18 -0700
commitc4e62be62e8d8a006cc9d7861232f511c5a05385 (patch)
tree2e28a575a3eef3bbf80ddd7d8f27ab607d720d85 /src/link/Elf.zig
parentf887b0251822f75dc4a3e24ca5337cb681c1eb1f (diff)
parentd0fd67cffe664ff70d9a70dd4d2d28aba5a378e8 (diff)
downloadzig-c4e62be62e8d8a006cc9d7861232f511c5a05385.tar.gz
zig-c4e62be62e8d8a006cc9d7861232f511c5a05385.zip
Merge pull request #16058 from ziglang/frontend-lib-paths
compiler: resolve library paths in the frontend
Diffstat (limited to 'src/link/Elf.zig')
-rw-r--r--src/link/Elf.zig10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
index c4371fbcbf..dd88d47fab 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -1428,7 +1428,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v
}
man.hash.addOptionalBytes(self.base.options.soname);
man.hash.addOptional(self.base.options.version);
- link.hashAddSystemLibs(&man.hash, self.base.options.system_libs);
+ try link.hashAddSystemLibs(&man, self.base.options.system_libs);
man.hash.addListOfBytes(self.base.options.force_undefined_symbols.keys());
man.hash.add(allow_shlib_undefined);
man.hash.add(self.base.options.bind_global_refs_locally);
@@ -1824,8 +1824,8 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v
argv.appendAssumeCapacity("--as-needed");
var as_needed = true;
- for (system_libs, 0..) |link_lib, i| {
- const lib_as_needed = !system_libs_values[i].needed;
+ for (system_libs_values) |lib_info| {
+ const lib_as_needed = !lib_info.needed;
switch ((@as(u2, @intFromBool(lib_as_needed)) << 1) | @intFromBool(as_needed)) {
0b00, 0b11 => {},
0b01 => {
@@ -1842,9 +1842,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v
// libraries and not static libraries (the check for that needs to be earlier),
// but they could be full paths to .so files, in which case we
// want to avoid prepending "-l".
- const ext = Compilation.classifyFileExt(link_lib);
- const arg = if (ext == .shared_library) link_lib else try std.fmt.allocPrint(arena, "-l{s}", .{link_lib});
- argv.appendAssumeCapacity(arg);
+ argv.appendAssumeCapacity(lib_info.path.?);
}
if (!as_needed) {