I'm just curious as to the possibility of loading and executing elf files on OSX. I know the standard executable format is MACHO, but NASM is unable to generate debug information for MACHO objects (and I am required to use NASM). I imagine its a long shot, but I don't suppose I can use ELF files. I can build them with NASM, but I can't seem to even link them with LD.
Asked
Active
Viewed 1.1k times
2 Answers
14
The author of the best OS X internals book has some code showing how you'd write a kernel extension to handle another executable file format here. He gives two examples: running running Google Native Client (NaCl) ELF applications and PDP-11 apps with Apout.
I'm not sure how mature this software is. It currently supports Leopard and better.

Glorfindel
- 21,988
- 13
- 81
- 109

stuntmouse
- 302
- 3
- 2
6
There's now an 'object converter' program that says it can convert ELF files to MACHO files, plus several other conversions for executable and object/loader files. See http://agner.org/optimize/#objconv for more information. Haven't tried it but there's extensive documentation available.

JESii
- 4,678
- 2
- 39
- 44
-
From it's documentation, he can convert .o libs, not .so files – mousomer Sep 08 '14 at 14:30