Hacker News new | past | comments | ask | show | jobs | submit login

I recall reading about new Macs with ARM chips not supporting static binaries. Is it not true?



That's been Apple's stance on full static linking MacOS in general, many years prior to the move to ARM e.g. https://developer.apple.com/library/archive/qa/qa1118/_index...

You're welcome to ignore it of course, it's just unofficial and a large pain.


>You're welcome to ignore it of course

How do you mean? Like, is it possible to run such binaries on M1? If so I'd really like to know how


You can always disassemble libc and look for the system call numbers used by the syscall assembly instructions. It’s just that these numbers (and associated arguments and return values) are not stable and can and do change upon kernel updates (in which case libc will be updated to keep the libc interface stable). I believe Linux is the only major OS these days to guarantee binary compatibility of the syscall interface.


I know this works on Macs with Intel chips. But the ones with ARM chips just won't execute fully static binaries, and I'm wondering if there's a workaround.


I’m guessing not. According to man ld on macOS, the -static flag, to produce a fully static executable, is only used to build the kernel. I don’t believe fully-static executables were ever officially supported on macOS, although they would work.


For clarity it's not the chip/ARM that causes the limitation, you can recompile the kernel (it's open source) to remove the block and it'll work fine - it's just a ton of work.

Alternatively, Linux :).


It only works if you don't ever upgrade macOS. Even a patch update sometimes can break it.


Nope.


Thanks. That sucks


If you can convince Apple to change this code let me know: https://github.com/apple-oss-distributions/xnu/blob/94d3b452...


All Macs don't support static binaries. That's because the syscall interface on macOS is not stable, only libc is guaranteed to be stable.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: