Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我使用命令“nasm -f elf -l hello.lst hello.asm”时,我在 linux 下使用 NASM 汇编程序,它工作正常,但是当与 gcc“gcc -o hello hello.o”链接时,它会产生错误:
hello.asm:(.text+0x4):重定位被截断以适应:R_386_16 对 `.data' collect2:ld 返回 1 个退出状态
我了解到这是 gcc 和 16 位的一些问题
任何解决方案?
Linux 甚至没有 16 位子系统——即使你有 gcc 来链接它,你仍然无法执行它!你为什么不直接使用.bits 32?
.bits 32
几年前和今年我都面临同样的情况。
处理它的两种方法是:
我总是最终做 2,但我可能应该花时间编写一个链接器(或修补 GNU ld...)。