Re: Linux binaries compatibility
Re: Linux binaries compatibility
- Subject: Re: Linux binaries compatibility
- From: Andrew Gallatin <email@hidden>
- Date: Wed, 31 Aug 2005 08:22:25 -0400 (EDT)
Markus Hitter writes:
> > and, if yes, at which cost/effort ?
>
> Obviously, you need an ELF linker. This linker probably should be
> able to link ELF binaries to ELF libraries as well as on-the-fly
> modified mach-o libraries. To get things running smoothly, a small
> kernel patch would be required to make the kernel acknowledge ELF
> binaries.
>
> Alternatively, dyld could be modified/extended to deal with ELF -
> this would require small patches (add a mach-o header) to all ELF
> binaries, though.
ELF support is a big sticking point. As I see it there are 3 ways to
support linux binaries:
1) ELF and Linux ABI support in the kernel (Like FreeBSD). It would
probably take somebody knowledgable less than a month to port, but it
requires changing both the syscall and exec code in the darwin kernel
to make it extensible (like *BSD's).
This should be very fast, and run binaries at native speeds. But I
doubt Apple would accept such a patch, since they generally don't want
people to be able to mess with syscalls.
2) ELF support in the kernel, linux ABI support at the level of a
userspace ELF dynamic linker (like BSDI's LAP). This again requires
modifying the darwin exec code to understand ELF & launch LAP when it
encounters a linux ELF binary. LAP then supplies its own version of
the linux libc, where all syscalls are translated to native Darwin
syscalls. This might be very easy to do; the LAP was open
source. But the code may be hard to find now that BSDI is gone.
See http://www.usenix.org/publications/library/proceedings/usenix2000/freenix/full_papers/seeley/seeley_html/
This would also be very fast, and able to run binaries at native
speeds. I have no idea if Apple would allow a patch to exec
ELF binaries.
3) ELF support and linux ABI support via a userlevel application like
lxrun which loads the ELF binary itself, and uses a signal handler to
catch SEGVs when the linux binary makes syscalls. This depends on
Darwin/x86 using a different syscall mechanism than linux, which I'm
not sure is true. The lxrun project used to be open source, but it
has been years since I've looked at it.
This would be a bit slower, especially for an application which makes
lots of syscalls.
I think the best approach is a LAP-like one, and that's what I'd
suggest to somebody starting out look into first.
Drew
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden