diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-08-03 09:53:18 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-03 09:53:18 -0700 |
| commit | c4e62be62e8d8a006cc9d7861232f511c5a05385 (patch) | |
| tree | 2e28a575a3eef3bbf80ddd7d8f27ab607d720d85 /src/link/Elf.zig | |
| parent | f887b0251822f75dc4a3e24ca5337cb681c1eb1f (diff) | |
| parent | d0fd67cffe664ff70d9a70dd4d2d28aba5a378e8 (diff) | |
| download | zig-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.zig | 10 |
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) { |
