authorgravatar for andrew.gutekanst@gmail.comAndrew Gutekanst <andrew.gutekanst@gmail.com> 2021-09-12 19:34:06-04:00
committergravatar for andrew.gutekanst@gmail.comAndrew Gutekanst <andrew.gutekanst@gmail.com> 2021-09-12 19:34:06-04:00
log62a6d83da11553daadb7d463330571f361c771d8
tree8b5cf980c07fe876e83d327a129abc700025cf17
parent6734271eb0b8b7eafd098986b30a5bc34e180b72

Address feedback


1 files changed, 14 insertions(+), 2 deletions(-)

src/link/MachO.zig+14-2
...@@ -491,9 +491,21 @@ fn resolveSearchDir(...@@ -491,9 +491,21 @@ fn resolveSearchDir(
491) !?[]const u8 {491) !?[]const u8 {
492 var candidates = std.ArrayList([]const u8).init(arena);492 var candidates = std.ArrayList([]const u8).init(arena);
493493
494 if (!fs.path.isAbsolute(dir)) {494 if (fs.path.isAbsolute(dir)) {
495 if (syslibroot) |root| {495 if (syslibroot) |root| {
496 const full_path = try fs.path.join(arena, &[_][]const u8{ root, dir });496 const common_dir = if (std.Target.current.os.tag == .windows) blk: {
497 // We need to check for disk designator and strip it out from dir path so
498 // that we can concat dir with syslibroot.
499 // TODO we should backport this mechanism to 'MachO.Dylib.parseDependentLibs()'
500 const disk_designator = fs.path.diskDesignatorWindows(dir);
501
502 if (mem.indexOf(u8, dir, disk_designator)) |where| {
503 break :blk dir[where + disk_designator.len ..];
504 }
505
506 break :blk dir;
507 } else dir;
508 const full_path = try fs.path.join(arena, &[_][]const u8{ root, common_dir });
497 try candidates.append(full_path);509 try candidates.append(full_path);
498 }510 }
499 }511 }