by@__dAi00
WA
499ms
extern printf ; 2: printf関数を持ってくる
; データセクション
section .data
fmt: db "x=%d", 10, 0 ; 6: printfで使うフォーマットを定義
; コードセクション
section .text
global _start ; 10: _startを指名
; スタート
_start:
; printfに使うレジスタの値を指定のレジスタに移動
mov rdi, fmt ; 16: printfのフォーマットをレジスタに置く
mov rsi, 1234567890 ; 17: 出力する数値の指定
mov rax, 0 ; 19: 返り値を0にする
call printf ; 21: printfをコール
; 後処理
mov rax, 1 ; 24: 返り値を1にする
mov rbx, 0 ; 25: 終了ステータスコード
int 0x80 ; 26: システムコール07 50 58 65 44 77 52 44 03 77 56 56
/tmp/code.asm:15: error: instruction not supported in 32-bit mode /tmp/code.asm:16: error: instruction not supported in 32-bit mode /tmp/code.asm:18: error: instruction not supported in 32-bit mode /tmp/code.asm:23: error: instruction not supported in 32-bit mode /tmp/code.asm:24: error: instruction not supported in 32-bit mode gcc: error: /tmp/code.o: No such file or directory gcc: fatal error: no input files compilation terminated. /bin/script: 16: /bin/script: /tmp/code: not found rm: cannot remove '/tmp/code.o': No such file or directory rm: cannot remove '/tmp/code': No such file or directory