Relocation truncated to R_X86_64_32S (Solved)
Posted: Thu May 14, 2015 8:16 am
Hey guys,
My current OS state is that I am able to jump to Longmode. Recently, I have encountered the following issue:
The first thing I am doing after initializing Longmode is the allocation of a stack. The issue is that when I try to load the stack address into the rsp register, the linker complains about that start address of the stack needs to be relocated (for whatever reason) and truncated: "relocation truncated to fit: R_X86_64_32S against `.kstack'".
Here is the code in question:
To compile this code I use the "large" memory model (-mcmodel=large).
The section .kstack is linked into the .bss section by my linker script:
As always: any help would be appreciated
My current OS state is that I am able to jump to Longmode. Recently, I have encountered the following issue:
The first thing I am doing after initializing Longmode is the allocation of a stack. The issue is that when I try to load the stack address into the rsp register, the linker complains about that start address of the stack needs to be relocated (for whatever reason) and truncated: "relocation truncated to fit: R_X86_64_32S against `.kstack'".
Here is the code in question:
To compile this code I use the "large" memory model (-mcmodel=large).
Code: Select all
.intel_syntax noprefix
.code64
.section .kstack, "aw", @nobits
kstack_bottom:
.skip 16384
kstack_top:
.section .text
.align 8
.globl _entry
.type _entry, @function
_entry:
cli
lea rsp, kstack_top
call k_early_init
.halt:
cli
hlt
jmp .halt
The section .kstack is linked into the .bss section by my linker script:
Code: Select all
.bss ALIGN(0x10) : AT(ADDR(.bss) - KERNEL_BASE)
{
PROVIDE (_sbss = .);
*(COMMON)
*(.bss)
*(.gnu.linkonce.b*)
*(.kstack)
PROVIDE (_ebss = .);
}