authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-08-01 21:09:12-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-08-03 09:52:14-07:00
log9e50f960875601dbaaf7245cedb7d9e429678aeb
tree7c0327ad202c92969a2549560048e8c3d22a0e2d
parent2725c20a723f7c2eca455a081a4d499723a21ac4

MachO: put system_libs into libs not positionals

Putting them in both causes collisions because the same lib ends up being linked in twice. Putting them in positionals instead of libs makes their properties about needed and weak being ignored.

1 files changed, 4 insertions(+), 9 deletions(-)

src/link/MachO/zld.zig+4-9
...@@ -3549,17 +3549,12 @@ pub fn linkWithZld(macho_file: *MachO, comp: *Compilation, prog_node: *std.Progr...@@ -3549,17 +3549,12 @@ pub fn linkWithZld(macho_file: *MachO, comp: *Compilation, prog_node: *std.Progr
3549 try positionals.append(comp.libcxx_static_lib.?.full_object_path);3549 try positionals.append(comp.libcxx_static_lib.?.full_object_path);
3550 }3550 }
35513551
3552 {
3553 // Add all system library paths to positionals.
3554 const vals = options.system_libs.values();
3555 try positionals.ensureUnusedCapacity(vals.len);
3556 for (vals) |info| positionals.appendAssumeCapacity(info.path);
3557 }
3558
3559 var libs = std.StringArrayHashMap(link.SystemLib).init(arena);3552 var libs = std.StringArrayHashMap(link.SystemLib).init(arena);
35603553
3561 for (options.system_libs.values()) |v| {3554 {
3562 try libs.put(v.path, v);3555 const vals = options.system_libs.values();
3556 try libs.ensureUnusedCapacity(vals.len);
3557 for (vals) |v| libs.putAssumeCapacity(v.path, v);
3563 }3558 }
35643559
3565 try MachO.resolveLibSystem(arena, comp, options.sysroot, target, options.lib_dirs, &libs);3560 try MachO.resolveLibSystem(arena, comp, options.sysroot, target, options.lib_dirs, &libs);