5 ms·
Rosetta 2 is great, except it apparently can't run statically-linked (non-PIC) binaries. I am unsure why this limitation exists, but it's pretty annoying becaus
by titzer 4y ago
Rosetta 2 is great, except it apparently can't run statically-linked (non-PIC) binaries. I am unsure why this limitation exists, but it's pretty annoying because Virgil x86-64-binaries cannot run under Rosetta 2, which means I resort to running on the JVM on my M1...
- saagarjha 4y agoRosetta can run statically linked binaries, but I don’t think anything supports binaries that aren’t relocatable. $ file a.out a.out: Mach-O 64-but executable x86_64 $ tool -L a.out a.out: $ ./a.out Hello, world!
- mirashii 4y agoStatically linked binaries are officially unsupported on MacOS in general, so there's no reason to support it on Rosetta either. It's unsupported in MacOS because it assumes binary compatibility on the kernel system call interface, which is not guaranteed.
- saagarjha 4y agoRosetta was introduced with the promise that it supports binaries that make raw system calls. (And it does indeed support these by hooking the syscall instruction.)
- CharlesW 4y ago> Rosetta 2 is great, except it apparently can't run statically-linked (non-PIC) binaries. Interestingly, it supports statically-linked x86 binaries when used with Linux. "Rosetta can run statically linked x86_64 binaries without additional configuration. Binaries that are dynamically linked and that depend on shared libraries require the installation of the shared libraries, or library hierarchies, in the Linux guest in paths that are accessible to both the user and to Rosetta." https://developer.apple.com/documentation/virtualization/running_intel_binaries_in_linux_vms_with_rosetta https://developer.apple.com/documentation/virtualization/run...
- randyrand 4y agoWhy are static binaries with PIC so rare? I’m surprised position dependent code is ever used anymore in the age of ASLR. But static binaries are still great for portability. So you’d think static binaries with PIC would be the default.
- masklinn 4y ago> But static binaries are still great for portability. macOS has not officially supported static binaries in... ever? You can't statically link libSystem, and it absolutely does not care for kernel ABI stability.
- titzer 4y ago> it absolutely does not care for kernel ABI stability That may be true on the mach system call side, but the UNIX system calls don't appear to change. (Virgil actually does call the kernel directly).
- masklinn 4y ago> That may be true on the mach system call side, but the UNIX system calls don't appear to change. They very much do, without warning, as the Go project discovered (after having been warned multiple times) during the Sierra betas: https://github.com/golang/go/issues/16272 https://github.com/golang/go/issues/16272 https://github.com/golang/go/issues/16606 https://github.com/golang/go/issues/16606 That doesn't mean Apple goes outs of its way to break syscalls (unlike microsoft), but there is no support for direct syscalls. That is why, again, you can't statically link libSystem. > (Virgil actually does call the kernel directly). That's completely unsupported ¯\_(ツ)_/¯
- comex 4y agoAnother example: https://github.com/jart/cosmopolitan/issues/426 https://github.com/jart/cosmopolitan/issues/426