Is it possible to create a Linux compatibility layer inside OS X?
Someone have created xbinary
, which is essentially an OS X port of binfmt_misc
as a kext, here: http://www.osxbook.com/software/xbinary/. Extending from the idea here, I am guessing if it is possible to create a Linux compatibility layer inside OS X:
xbinary
is obviously what makes the kernel accepts ELF. When an ELF is encountered ...ld-linux.so
which itself is a Mach-O binary is started, loading ELF libraries (Mach-O libraries can also be used, to some extent).int 80h
on x86
and amd64
systems) and translates them into corresponding OS X syscalls in kernel, or let the ld-linux.so
replace all syscalls with a small function call in another library that translates them in userland.I think you would also need to make OS X support Linux personality so that the syscalls behave identically to those of Linux (if present)
Other than that a binary might depend on a VDSO shim present in higher randges of address space, which is usually taken care of by libc
implementation on Linux
Many other subtleties are possible...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With