我正在尝试在我的 Mac 上的终端中运行以下代码:
.section, .data
format_string:
.asciz "My favorite number is %d!"
number:
.long 786
.section, .text
.globl main
main:
pushl number
pushl $format_string
call printf
addl $8, %esp
pushl $0
call exit
此代码位于名为 favorite.s 的文件中
我使用命令“gcc favorite.s -m32”并看到以下消息:
Undefined symbols for architecture i386:
"_main", referenced from:
start in crt1.10.6.o
"exit", referenced from:
main in ccUKdD8O.o
"printf", referenced from:
main in ccUKdD8O.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
我在这里做错了什么?谢谢。