|
|
|
|
|
by mbeddedartistry
1399 days ago
|
|
Please provide a source for a statically linked application on MacOS, Intel or otherwise. When I wrote this article, Apple's own documentation said it was not supported. libSystem is also only provided as a dynamic library. |
|
This is a reflection of historical differences in opinion about whether the stable ABI for an OS kernel should be the kernel itself (ala Linux), libc (ala Solaris or OpenBSD), or a language-agnostic library (Windows NT's ntdll).
macOS seems to be in a transition period toward the Windows model, with libSystem providing trampolines into the kernel. However, they don't yet enforce this model like OpenBSD does, so if you're willing to risk the syscall numbers changing you can do without libSystem.
Here's an example, lightly adapted from <https://john-millikin.com/unix-syscalls#darwin-x86-64>:
Compile (assemble?) it to a static binary: It runs fine: