diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2021-09-13 09:04:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-13 09:04:11 +0200 |
| commit | 50e34a063c270e1fe4fe9b0342ca300bc937d96a (patch) | |
| tree | 1261912817f7bbf5ff63c9461d4bb2d7536d2f6b /src | |
| parent | c4f97d336528d5b795c6584053f072cf8e28495e (diff) | |
| parent | ffb989169594cbfcfefbbcc00dd7c3d07f1a9949 (diff) | |
| download | zig-50e34a063c270e1fe4fe9b0342ca300bc937d96a.tar.gz zig-50e34a063c270e1fe4fe9b0342ca300bc937d96a.zip | |
Merge pull request #9734 from Andoryuuta/macho-zld-win-filepath
link/include: fix invalid file path concatenation when cross-compiling for Windows -> Mac
Diffstat (limited to 'src')
| -rw-r--r-- | src/link/MachO.zig | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 12556b53d6..de5e789b8c 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -493,7 +493,19 @@ fn resolveSearchDir( if (fs.path.isAbsolute(dir)) { if (syslibroot) |root| { - const full_path = try fs.path.join(arena, &[_][]const u8{ root, dir }); + const common_dir = if (std.Target.current.os.tag == .windows) blk: { + // We need to check for disk designator and strip it out from dir path so + // that we can concat dir with syslibroot. + // TODO we should backport this mechanism to 'MachO.Dylib.parseDependentLibs()' + const disk_designator = fs.path.diskDesignatorWindows(dir); + + if (mem.indexOf(u8, dir, disk_designator)) |where| { + break :blk dir[where + disk_designator.len ..]; + } + + break :blk dir; + } else dir; + const full_path = try fs.path.join(arena, &[_][]const u8{ root, common_dir }); try candidates.append(full_path); } } |
