# link: fix invalid file path used when cross-compiling for Windows \-\> Mac · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/6734271eb0b8b7eafd098986b30a5bc34e180b72)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 6734271eb0b8b7eafd098986b30a5bc34e180b72

Requested commit: 6734271eb0b8b7eafd098986b30a5bc34e180b72

Commit: 6734271eb0b8b7eafd098986b30a5bc34e180b72

Tree: cda1ce0885d8eff9aba9e955432fb8a51314f018

Author: Andrew Gutekanst

Committer: Andrew Gutekanst

## Message

```
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>

```

## Parents

- [0c091feb5ae52caf1ebf885c0de55b3159207001](https://git.cafe/gitcafe/zig/commit/0c091feb5ae52caf1ebf885c0de55b3159207001?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/6734271eb0b8b7eafd098986b30a5bc34e180b72?format=markdown)
