diff options
| author | Andrew Gutekanst <andrew.gutekanst@gmail.com> | 2021-09-10 23:52:46 -0400 |
|---|---|---|
| committer | Andrew Gutekanst <andrew.gutekanst@gmail.com> | 2021-09-10 23:55:13 -0400 |
| commit | 6734271eb0b8b7eafd098986b30a5bc34e180b72 (patch) | |
| tree | cda1ce0885d8eff9aba9e955432fb8a51314f018 /src | |
| parent | 0c091feb5ae52caf1ebf885c0de55b3159207001 (diff) | |
| download | zig-6734271eb0b8b7eafd098986b30a5bc34e180b72.tar.gz zig-6734271eb0b8b7eafd098986b30a5bc34e180b72.zip | |
link: fix invalid file path used when cross-compiling for Windows -> Mac
While investigating hexops/mach#8 with @slimsag,
we found that zld is forming invalid file paths (absolute paths concatenated together),
which hits the unreachable `OBJECT_NAME_INVALID` case in `openDirAccessMaskW`:
https://github.com/ziglang/zig/blob/0c091feb5ae52caf1ebf885c0de55b3159207001/lib/std/fs.zig#L1522
This is caused by appending `dir` (which is guaranteed to be absolute) to `root`,
an obviously incorrect operation:
https://github.com/ziglang/zig/blob/0c091feb5ae52caf1ebf885c0de55b3159207001/src/link/MachO.zig#L494-L499
Fixes hexops/mach#8
Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Signed-off-by: Andrew Gutekanst <andrew.gutekanst@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/link/MachO.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 12556b53d6..2b7fa280ba 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -491,7 +491,7 @@ fn resolveSearchDir( ) !?[]const u8 { var candidates = std.ArrayList([]const u8).init(arena); - if (fs.path.isAbsolute(dir)) { + if (!fs.path.isAbsolute(dir)) { if (syslibroot) |root| { const full_path = try fs.path.join(arena, &[_][]const u8{ root, dir }); try candidates.append(full_path); |
