Assembly nasm:重新定位被截断以适应:R_386_PC8与`*UND*';
链接下面的代码时出现以下错误,但我不明白原因:Assembly nasm:重新定位被截断以适应:R_386_PC8与`*UND*';,assembly,x86,nasm,Assembly,X86,Nasm,链接下面的代码时出现以下错误,但我不明白原因: 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
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
就像我在前面的代码中所做的那样,只需为循环使用一个标签。我称之为michael,但请记住,您必须首先像这样定义它michael:然后才能使用它。修改
循环0xb7
以使用标签而不是立即值。此外,请更加努力;)
push eax
michael:
lodsb
xor eax,ebx
stosb
loop michael
push esp
pop esi
int3