by@__Hyoga
WA
487ms
extern printf ; 2: printf関数を持ってくる
; データセクション
section .data
fmt: db "x=%d", 10, 0 ; 6: printfで使うフォーマットを定義
; コードセクション
section .text
global _start ; 10: _startを指名
; スタート
_start:
; printfに使うレジスタの値を指定のレジスタに移動
mov edi, fmt ; 16: printfのフォーマットをレジスタに置く
mov esi, 1234567890 ; 17: 出力する数値の指定
mov eax, 0 ; 19: 返り値を0にする
call printf ; 21: printfをコール
; 後処理
mov eax, 1 ; 24: 返り値を1にする
mov ebx, 0 ; 25: 終了ステータスコード
int 0x80 ; 26: システムコール20 69 04 99 84 03 89 90 32 70 27 44
/tmp/code.o: In function `_start': /tmp/code.asm:(.text+0x10): undefined reference to `printf' collect2: error: ld returned 1 exit status /bin/script: 16: /bin/script: /tmp/code: not found rm: cannot remove '/tmp/code': No such file or directory