by@__dAi00
WA
495ms
extern printf ; 2: printf関数を持ってくる
; データセクション
section .data
fmt: db "x=%d", 10, 0 ; 6: printfで使うフォーマットを定義
; コードセクション
section .text
global main
; スタート
main:
; 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: システムコール91 50 97 87 45 03 70 09 59 91 96 83
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 00000000080480c0 /tmp/code.o: In function `main': /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