我在NASM和ld中遇到以下错误:
tamal@baba-desktop:~/Desktop$ nasm -f elf basic.asm
tamal@baba-desktop:~/Desktop$ gcc basic.o -o basic
basic.o: In function `main':
basic.asm:(.text+0x27): relocation truncated to fit: R_386_16 against `.text'
basic.o: In function `main.keyword':
basic.asm:(.text+0x30): relocation truncated to fit: R_386_16 against `.text'
basic.asm:(.text+0x34): relocation truncated to fit: R_386_16 against `.text'
basic.asm:(.text+0x43): relocation truncated to fit: R_386_16 against `.text'
basic.asm:(.text+0x52): relocation truncated to fit: R_386_16 against `.text'
basic.asm:(.text+0x61): relocation truncated to fit: R_386_16 against `.text'
basic.asm:(.text+0x70): relocation truncated to fit: R_386_16 against `.text'
basic.asm:(.text+0x7f): relocation truncated to fit: R_386_16 against `.text'
basic.asm:(.text+0x8e): relocation truncated to fit: R_386_16 against `.text'
basic.asm:(.text+0x9d): relocation truncated to fit: R_386_16 against `.text'
basic.asm:(.text+0xac): additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
代码的一部分是:
section .text
global main
main:
call get_token
cmp ax, STRING
je .keyword
cmp ax, VARIABLE
je near assign
cmp ax, STRING_VAR
je near assign
cmp ax, LABEL
je main
mov si, err_syntax
jmp error
.keyword:
mov si, token
mov di, alert_cmd
call os_string_compare
jc near do_alert
mov di, askfile_cmd
call os_string_compare
jc near do_askfile
mov di, break_cmd
call os_string_compare
jc near do_break
mov di, case_cmd
call os_string_compare
jc near do_case
mov di, call_cmd
call os_string_compare
jc near do_call
.......
.......