elf: add native libc* system libraries to the invocation

This commit is contained in:
Jakub Konka
2023-10-17 23:23:33 +02:00
parent eb5276c94e
commit 533e2671c9

View File

@@ -1383,8 +1383,15 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node
// libc dep
self.error_flags.missing_libc = false;
if (self.base.options.link_libc) {
if (self.base.options.libc_installation != null) {
@panic("TODO explicit libc_installation");
if (self.base.options.libc_installation) |lc| {
const flags = target_util.libcFullLinkFlags(target);
try system_libs.ensureUnusedCapacity(flags.len);
for (flags) |flag| {
const lib_path = try std.fmt.allocPrint(arena, "{s}{c}lib{s}.so", .{
lc.crt_dir.?, fs.path.sep, flag["-l".len..],
});
system_libs.appendAssumeCapacity(.{ .path = lib_path });
}
} else if (target.isGnuLibC()) {
try system_libs.ensureUnusedCapacity(glibc.libs.len + 1);
for (glibc.libs) |lib| {