Commit f3ff0b6e6d

Michael Dusan <michael.dusan@gmail.com>
2023-09-23 18:44:54
macos: discontinue redundant search/link for libc
1 parent f40c6a5
Changed files (2)
src
link
src/link/MachO/zld.zig
@@ -317,7 +317,6 @@ pub fn linkWithZld(
             try argv.append(full_out_path);
 
             try argv.append("-lSystem");
-            try argv.append("-lc");
 
             for (options.system_libs.keys()) |l_name| {
                 const info = options.system_libs.get(l_name).?;
src/link/MachO.zig
@@ -676,27 +676,6 @@ pub fn resolveLibSystem(
         .weak = false,
         .path = libsystem_path,
     });
-
-    const ext = fs.path.extension(libsystem_path);
-    if (mem.eql(u8, ext, ".dylib")) {
-        // We found 'libSystem.dylib', so now we also need to look for 'libc.dylib'.
-        success: {
-            if (self.base.options.sysroot) |root| {
-                const dir = try fs.path.join(tmp_arena, &[_][]const u8{ root, "usr", "lib" });
-                if (try accessLibPath(tmp_arena, &test_path, &checked_paths, dir, "libc")) break :success;
-            }
-
-            for (search_dirs) |dir| if (try accessLibPath(
-                tmp_arena,
-                &test_path,
-                &checked_paths,
-                dir,
-                "libc",
-            )) break :success;
-
-            try self.reportMissingLibraryError(checked_paths.items, "unable to find libc system library", .{});
-        }
-    }
 }
 
 fn accessLibPath(