议题作者:llehotnwod
信息来源:邪恶八进制信息安全团队(
www.eviloctal.com)
我写了如下:
复制内容到剪贴板
代码:
%include 'system.inc'
section .data
myint dw 1234
mystring db 'This is number -> %d <- should be 1234',10,0
section .bss
section .text
global _start
_start:
extern _printf
;and then, further down...
push word[myint]
push word mystring
call _printf
add sp,byte 8
xor eax, eax
push eax
sys.exit;;;;;;;;;;是个宏,在system.inc里面不知道怎么链接,makefile如下,但make时报错
复制内容到剪贴板
代码:
asm:aa.o
ld -s -o asm aa.o
aa.o:hi.asm system.inc
nasm -f elf hi.asm -o aa.o报错信息如下:
复制内容到剪贴板
代码:
make
ld -s -o asm aa.o
aa.o(.text+0xc): In function `_start':
: relocation truncated to fit: R_386_16 .data
aa.o(.text+0xf): In function `_start':
: undefined reference to `_printf'
*** Error code 1