链接下面的代码时出现以下错误,但我不明白为什么:
ld -m elf_i386 shell.o -o test
shell.o: In function `_start':
shell.asm:(.text+0xbc): relocation truncated to fit: R_386_PC8 against `*UND*'
代码:
SECTION .text
global _start ;must be declared for linker (ld)
_start:
xor eax,eax
push eax
push 0x25722424
push 0x73747670
push 0x24777470
push 0x75792278
push 0x27757070
push 0x23732473
push 0x70277275
push 0x22247975
push 0x27237824
push 0x20722774
push 0x24257674
push 0x79237524
push 0x24752377
push 0x22727925
push 0x27772020
push 0x71792771
push 0x72257073
push 0x78237173
push 0x71767975
push 0x73717871
push 0x20727827
push 0x27782272
push 0x74797423
push 0x25742271
push 0x72772225
push 0x70247024
push 0x72727023
push 0x24782078
push 0x71742023
push 0x71242379
push 0x22787024
push 0x24782374
push esp
pop esi
mov edi,esi
mov edx,edi
cld
mov ecx,0x80
mov ebx,0x41
xor eax,eax
push eax
lodsb
xor eax,ebx
stosb
loop 0xb7
push esp
pop esi
int3
答案 0 :(得分:3)
push eax
michael:
lodsb
xor eax,ebx
stosb
loop michael
push esp
pop esi
int3
只需像上一段代码中那样使用循环标签。我称之为迈克尔,但记住你必须先像迈克尔那样定义它:然后你可以使用它。