這段代碼打印Hello屏幕上ASM的printf怪異的行爲
.data
hello: .string "Hello\n"
format: .string "%s"
.text
.global _start
_start:
push $hello
push $format
call printf
movl $1, %eax #exit
movl $0, %ebx
int $0x80
但如果我刪除你好字符串 '\ N',像這樣:
.data
hello: .string "Hello"
format: .string "%s"
.text
.global _start
_start:
push $hello
push $format
call printf
movl $1, %eax #exit
movl $0, %ebx
int $0x80
程序不能正常工作。有什麼建議麼?
定義_「沒有按不工作「。 – Michael
它不打印「你好」 – Dima
你確定它不會被shell的提示覆蓋嗎?如果你使用一個非常長的字符串(但仍然沒有'\ n')會怎樣? – Michael