2017-06-03 36 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 

只需像我在前面的代碼中那樣使用循環標籤即可。我把它叫做邁克爾,但記住你必須先像這樣定義邁克爾:然後你可以使用它。

相關問題