linux - 如何编译调用printf的nasm程序?
问题描述
https://cs.lmu.edu/~ray/notes/nasmtutorial/
尝试fib.asm
在 Linux 上编译时出现以下错误。你能告诉我如何编译它吗?谢谢。
$ nasm -felf64 fib.asm && gcc fib.o && ./a.out
/usr/bin/ld: fib.o: warning: relocation in read-only section `.text'
/usr/bin/ld: fib.o: relocation R_X86_64_PC32 against symbol `printf@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
解决方案
推荐阅读
- hive - Hive : 在子查询中添加分区列数据
- azure - 如何配置在 AKS 群集中分配的 VM 的默认类型
- r - 插值高频时间序列
- linux - 安装到 linux docker 容器卷的 Windows 文件夹不显示所有文件夹
- c++ - 修改结构中的数据时遇到问题
- excel - 如何在工作表单元格中插入 SQL 查询的结果
- r - 选择一个模式,该模式将只选择以 r、s 或 t 开头的整个单词,无论大小写如何
- python - 如何通过网络抓取将表格数据从网站写入 CSV
- python - Django Rest Framework - 显示用户的个人资料
- c - 为什么我的程序的输出包含一个额外的换行符?