|
一个简单问题.
我想通过编译和链接两步来得到二进制文件a. 源程序是nasm的, 如下
---
;hello.asm
section .text
extern puts
global main
_start:
push dword msge;
call puts;
add esp, byte 4;
ret;
msge :
db "hello, world!", 0
===
生成 ``a'' 所用命令如下
---
nasm -f elf a.asm
ld -o a a.o
===
我得到如下错误信息
---
ld: warning: cannot find entry symbol _start; defaulting to 08048060
a.o: In function `_start':
a.asm : (.text+0x6) : undefined reference to `puts'
===
显然错误是由于不能链接puts造成的. 有没有什么简单的办法, 使得可以正确链接它呢?
[ 本帖最后由 JulianL 于 2008-8-23 17:00 编辑 ] |
|