Commit 533e2671c9

Jakub Konka <kubkon@jakubkonka.com>
2023-10-17 23:23:33
elf: add native libc* system libraries to the invocation
1 parent eb5276c
Changed files (1)
src
link
src/link/Elf.zig
@@ -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| {