Set the preserve argv0 flag for Rosetta installations on macOS > 13
- Dominant language
- Go
- Stars
- 21.9k
- Forks
- 957
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 53
Description
### Description
The current rosetta binfmt_misc code does not set the preserve argv0 (`P`) flag when registering the binfmt handler. This flag is supported since macOS 14, and Apple even [recommends it in their documentation](https://developer.apple.com/documentation/virtualization/running-intel-binaries-in-linux-vms-with-rosetta#Mount-the-Shared-Directory-and-Register-Rosetta).
This means that programs that look at their own `argv[0]` will get the actual path that they were called by, instead of the full resolved path that Rosetta would otherwise provide. This fixes some subtle bugs in programs such as `clang` that look at the path by which they were called to resolve sysroots.
This is a fairly trivial thing to implement, since the set up code only needs to check the macOS version and if it's above 13 it can add the 'P' flag.
Contributor guide
Assessment
This issue has not been assessed yet.