汇编:..exocation截断以适应

时间:2016-01-16 16:09:07

标签: linux assembly x86 att

使用Linux x86程序集和AT& T语法我想做一个 max 次的程序,打印这个循环的计数器。我试过这个:

.data

.text

.global main

diff    =   48
max     =   5   

count:  .byte   0
p:      .byte   0

main:

compare:
    movb    $count,%al
    cmp     $max,%al
    jnb     end

    movl    $4,%eax
    movl    $1,%ebx
    xor     %ecx,%ecx
    addb    $diff,%cl
    addb    $count,%cl
    movb    %cl,p
    movb    $p,%cl
    movl    $1,%edx
    int     $0x80

    movb    $count,%al
    inc     %al
    movb    %al,count
    jmp     compare

end:
    movl    $1,%eax
    movl    $0,%ebx
    int     $0x80

但是gcc给了我这些错误:

/tmp/ccqobwxL.o: In function `compare':
(.text+0x3): relocation truncated to fit: R_386_8 against `.text'
/tmp/ccqobwxL.o: In function `compare':
(.text+0x19): relocation truncated to fit: R_386_8 against `.text'
/tmp/ccqobwxL.o: In function `compare':
(.text+0x21): relocation truncated to fit: R_386_8 against `.text'
/tmp/ccqobwxL.o: In function `compare':
(.text+0x2a): relocation truncated to fit: R_386_8 against `.text'
collect2: error: ld returned 1 exit status

有什么问题,我该如何解决?

0 个答案:

没有答案