mov si causes linking error
Posted: Thu Aug 26, 2010 4:01 pm
So I have this code
It compiles fine, but when linked I get the error " In function `ssblstart':
ssbootloader.s:(.text+0x8): relocation truncated to fit: R_386_16 against `.data' "
When I comment out the mov si, greeting it links fine. I checked around, and it seems that most of the time when there is this problem it's because someone is using 32 bit code in 16 bit mode, or visa-versa. This is all 16 bit code though...
Code: Select all
;**********************ssbootloader.s**********************;
; The second stage bootloader
BITS 16
section .data
greeting db 'Bootloader has loaded', 13, 10, 0
section .text
global ssblstart
ssblstart:
; set up stack pointer
mov ax, 0x7BFF
mov sp, ax
mov bp, sp
mov si, greeting
call printString
hlt
printString:
lodsb ; Load character of string
or al, al ; Check to see if al is zero
jz psreturn
mov ah, 0x13
int 0x10
jmp printString
psreturn:
ret
ssbootloader.s:(.text+0x8): relocation truncated to fit: R_386_16 against `.data' "
When I comment out the mov si, greeting it links fine. I checked around, and it seems that most of the time when there is this problem it's because someone is using 32 bit code in 16 bit mode, or visa-versa. This is all 16 bit code though...