From 041d4fe56e9f0a167dec3697413b89b6a4c95670 Mon Sep 17 00:00:00 2001 From: "tengfei.chen" Date: Sat, 15 Jul 2023 02:10:18 -0400 Subject: [PATCH] fix asm code error in Misc/linux-misc-3.md --- Misc/linux-misc-3.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Misc/linux-misc-3.md b/Misc/linux-misc-3.md index ff12286..294b735 100644 --- a/Misc/linux-misc-3.md +++ b/Misc/linux-misc-3.md @@ -491,22 +491,22 @@ $ ld -M @linker.ld ```assembly .data - msg .ascii "hello, world!",`\n` + msg: .ascii "hello, world!\n" .text - global _start - -_start: - mov $1,%rax - mov $1,%rdi - mov $msg,%rsi - mov $14,%rdx - syscall +.global _start - mov $60,%rax - mov $0,%rdi - syscall +_start: + mov $1,%rax + mov $1,%rdi + mov $msg,%rsi + mov $14,%rdx + syscall + + mov $60,%rax + mov $0,%rdi + syscall ``` 我们可以用以下命令编译并链接: