Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
x86 用のアセンブリ コードを書き、Mac の既定のアセンブラ (「as」) を使用してプレーン バイナリ ファイル (Mach-O ではない) にアセンブルしたいと考えました。いくつかのグーグルと試行の後、私は失敗しました。
NASM (オプション: -f binary を使用) でそれを行う方法は知っていますが、そうしたくありません。私のコードは で書かれていて、AT&T の構文に慣れていたからです。
objcopy(binutils の一部であるas) を--output-targetset toで使用しbinaryます。
objcopy
as
--output-target
binary
as --64 test.s -o test.o objcopy -O binary test.o test.bin
出力を逆アセンブルするには:
objdump -D -m i386:x86-64:intel -b binary test.bin
( 32ビット版は差し替え--32て削除)x86-64:
--32
x86-64: