I wrote some assembly code for x86, and wanted to assemble it into plain binary file (not Mach-O) by just using Mac’s default assembler (the ‘as’). After several googlings and tries, I failed.
Though I know how to do it with NASM (using option: -f binary), I don’t want to do so. Because my code was written in and I was used to AT&T syntax.
Use
objcopy(which is part of binutils as isas) with--output-targetset tobinary.And to disassemble the output:
(Substitute
--32and removex86-64:for 32-bit versions)