Skip to main content


Topic: Fasm for OS X (Read 3589 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
Fasm for OS X
My favorite assembler by far is FASM (the Flat Assembler). Generally, I don't do very much ASM work, but I prefer FASM because it makes it extremely simple to link the object files it generates with C/C++ projects simply using my C/C++ linker.

It's also very nice that is an extremely in-depth x86 (16 and 32 bit) and amd64 assembly guide, complete with an entire listing of instructions, included with it.

FASM isn't distributed for OS X, but a 'blank' assembled ELF32 object file is for Unix-like OS's. After a little work, and using Agner Fog's object converter, I managed to get this converted to the native Mach-O format of OS X, change its symbols to use underscores (since basically all C libraries require/expect this). After that, it was a simple matter to link the resulting object file, and get a working FASM executable.

Any files created with it would have to be converted to Mach-O to be used with Clang/LLVM, but that's simple with objconv. And given that, if you get to that point, you just wrote a bunch of ASM and are linking it with a native C/C++ project, I doubt that adding a builder definition to your build scripts would be too complex to handle :)

I've looked around, and I can't find any other place where this process is detailed, and I found lots of unanswered questions when DuckDuckGo'ing for 'Fasm for OS X'. So if I'm not the first to get this working, whoever else has done it isn't talking about it.

A copy of the OS X Fasm executable, along with the source, the intermediate files, and full instructions on how to build it yourself can be found at
  • Last Edit: July 30, 2014, 01:56:00 pm by Flying Jester