Some notes on implementing MachO loading and
dyld on ravynOS as an early PoC.
So far, I have modified rtld-elf (the FreeBSD runtime linker) to handle simple MachO objects. It can now successfully load and run a trivial MachO executable built on a Mac with an external library dependency (libSystem.B.dylib - the C library). The linker also still handles ELF objects, so I call this monstrosity the "Macho ELF".
Loading a MachO object into the dynamic linker
★ zoe@haru ~/airyx-freebsd/libexec/dyldᐳ llvm-objdump -d hello