FreeBSD MachO File format, your comments on it.

David Chisnall theraven at FreeBSD.org
Thu Mar 24 12:21:36 UTC 2016


On 24 Mar 2016, at 12:05, mokhi <mokhi64 at gmail.com> wrote:
> 
> Hi.
> 
> I'm agreed with point you told about improvements we can do for fat
> format (or more).
> And I'm ready to do them (with your helps, sure :D).
> 
> But we need short steps and more of them (a local proverb :D) IMO.
> If we completely do this image activator, then we can have 2 sub plans
> for OSX emulation and/or fat data segment redesign.

FatELF binaries do not depend on this work.  Fat Mach-O binaries do, but the pain of working with Mach-O is not worth it (talk to some of the Apple toolchain team some time about how much effort Mach-O is - I’m glad it’s their problem and not mine).

I don’t believe that the work to support FatELF would be particularly large.  The format is pretty simple (basically a small header that tells you where within the binaries to find the real ELF for your architecture).  Teaching all of the associated bits of the toolchain (especially debuggers) about it is a lot of tedious work, but not particularly hard if someone is motivated to do it.  Teaching clang and lld to produce fat binaries as part of normal ELF compilation would be a bit more work.

> I saw netbsd's way of mach-kernel/darwin emulation.
> They have been stopped in porting/simulating quartz (the reason
> described lack of developers' interest IIRC), and that relates to OSX
> emulating.

That wasn’t the only reason.  The XNU kernel interfaces for graphics and sound are large and mostly undocumented (at least, publicly) and change between OS X revisions.  Even if you implement *all* of this, then you’d still need most of an OS X userland to be able to run OS X applications.  This would involve violating the OS X EULA unless you ran it on a Mac and the only thing that you’d then be able to do that you couldn’t with OS X is run FreeBSD binaries in the background or in XQuartz (which you can already do pretty well with xhyve on OS X).  If you are willing to violate the OS X EULA then you should probably just run OS X in a VM.

> If we wanna complete/continue that way, first we need this image
> activator, what's your opinion about it?
> 
> BTW, in brief I believe we can have strategies to do (sub plans) and
> it worth (at least for me, because I'll learn good things). What's
> your opinion?

As a learning exercise, I definitely encourage you to continue.  Writing a new image activator will teach you a lot.  If you want to do some of the rtld work to make a partial Mach-O rtld then you’ll learn even more.  I just don’t think that the end result will be something that’s particularly useful to anyone.

David



More information about the freebsd-current mailing list