macos - macOS assembly, cannot use str() command
问题描述
I have been following this tutorial and have got stuck at the following code: leaq str(%rip), %rdi
.
My full assembly code is the following:
.data
.text
.globl _main
_main:
pushq %rbp
movq %rsp, %rbp
subq $32, %rsp
leaq str(%rip), %rdi
callq _printf
And my Makefile:
build:
as main.s -o main.o
ld main.o -e _main -lc -macosx_version_min 10.13 -arch x86_64 -o main
run: build
./main
And finally the output of the command make build
:
as main.s -o main.o
ld main.o -e _main -lc -macosx_version_min 10.13 -arch x86_64 -o main
Undefined symbols for architecture x86_64:
"str", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
make: *** [build] Error 1
How am I able to link the str
command for use in macOS assembly?
解决方案
推荐阅读
- xamarin - 如何在 Xamarin Forms 中打开滑动时更改滑动视图内容的不透明度?
- sql - 如何使 SUM() 仅对 MIN() 选择的乘客求和?
- c++ - 错误:
, 'cstdalign' 文件未找到,运行 C++17 - java - 运行 Wrapped Jar 时未找到 JavaFX AlertType 类(JavaFX + SpringBoot + Gradle + launch4j)
- git - 在 CI/CD 管道 (AWS CodeBuild) 中运行构建时出现 Git Refs 错误
- python - 从数据帧中查找字符串中子字符串的索引
- java - ViewFlipper 未显示其所有子项
- python - 有没有办法在 Odoo 12 的树视图中的操作菜单中添加额外的操作?
- php - 根据 XML 格式打印地址
- c++ - 什么是指定初始化器?