3 ms·
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 arg
by telotortium 2y ago
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.
- oguz-ismail 2y agoI 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.
- saagarjha 2y agoNope.
- oguz-ismail 2y agoThanks. That sucks
- saagarjha 2y agoIf you can convince Apple to change this code let me know: https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/bsd/kern/mach_loader.c#L877 https://github.com/apple-oss-distributions/xnu/blob/94d3b452...
- deleted 2y ago[deleted]
- telotortium 2y agoI’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.
- jcelerier 2y agoIt only works if you don't ever upgrade macOS. Even a patch update sometimes can break it.
- zamadatix 2y agoFor 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 :).