2017-06-03 30 views
0

我下面的代码链接时收到以下错误,但我不明白为什么:NASM:搬迁截断以适应:R_386_PC8对`* UND *”

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 
+2

将'loop 0xb7'修改为使用标签而不是立即值。 –

回答

0
push eax 
michael: 
lodsb 
xor eax,ebx 
stosb 
loop michael 
push esp 
pop esi 
int3 

只需像我在前面的代码中那样使用循环标签即可。我把它叫做迈克尔,但记住你必须先像这样定义迈克尔:然后你可以使用它。

相关问题