Relocation truncated to fit error from ld
Posted: Wed Jul 01, 2020 6:34 am
Hello,
I am switching my kernel from PE to ELF. When I did so, the 64 bit link failed. Here are the errors from ld
The linker command line looks like this:
And finally, the linker script looks like this
Thanks for your help,
nexos
I am switching my kernel from PE to ELF. When I did so, the 64 bit link failed. Here are the errors from ld
Code: Select all
../../Libs/Klib.lib(Cpu.o): in function `HalCpuInit':
/home/nexware/NexOS/NexKe/Hal/x64/Cpu.c:18:(.text+0x29): relocation truncated to fit: R_X86_64_32 against `.rodata.str1.1'
../../Libs/Klib.lib(Idt.o): in function `HalDefHandler':
/home/nexware/NexOS/NexKe/Hal/x64/Idt.c:19:(.text+0x1): relocation truncated to fit: R_X86_64_32 against `.rodata.str1.1'
../../Libs/Klib.lib(Idt.o): in function `HalIdtInit':
/home/nexware/NexOS/NexKe/Hal/x64/Idt.c:26:(.text+0x20): relocation truncated to fit: R_X86_64_32 against symbol `idt' defined in .bss section in ../../Libs/Klib.lib(Idt.o)
/home/nexware/NexOS/NexKe/Hal/x64/Idt.c:30:(.text+0x3f): relocation truncated to fit: R_X86_64_32 against symbol `HalDefHandler' defined in .text section in ../../Libs/Klib.lib(Idt.o)
../../Libs/Klib.lib(Isr.o): in function `HalIsrInstall':
/home/nexware/NexOS/NexKe/Hal/x64/Isr.c:49:(.text+0x11): relocation truncated to fit: R_X86_64_32 against symbol `isr0' defined in .text section in ../../Libs/Klib.lib(IsrStub.o)
/home/nexware/NexOS/NexKe/Hal/x64/Isr.c:50:(.text+0x2b): relocation truncated to fit: R_X86_64_32 against symbol `isr1' defined in .text section in ../../Libs/Klib.lib(IsrStub.o)
/home/nexware/NexOS/NexKe/Hal/x64/Isr.c:51:(.text+0x47): relocation truncated to fit: R_X86_64_32 against symbol `isr2' defined in .text section in ../../Libs/Klib.lib(IsrStub.o)
/home/nexware/NexOS/NexKe/Hal/x64/Isr.c:52:(.text+0x63): relocation truncated to fit: R_X86_64_32 against symbol `isr3' defined in .text section in ../../Libs/Klib.lib(IsrStub.o)
/home/nexware/NexOS/NexKe/Hal/x64/Isr.c:53:(.text+0x7f): relocation truncated to fit: R_X86_64_32 against symbol `isr4' defined in .text section in ../../Libs/Klib.lib(IsrStub.o)
/home/nexware/NexOS/NexKe/Hal/x64/Isr.c:54:(.text+0x9b): relocation truncated to fit: R_X86_64_32 against symbol `isr5' defined in .text section in ../../Libs/Klib.lib(IsrStub.o)
/home/nexware/NexOS/NexKe/Hal/x64/Isr.c:55:(.text+0xb7): additional relocation overflows omitted from the output
Code: Select all
x86_64-elf-gcc -o NexKe.elf -z max-page-size=0x1000 -TArch/x64/link.ld -g -O2 -mno-red-zone -ffreestanding -fPIC Start/Entry.o Start/Init.o Start/Panic.o Memmgr/Placement.o ../../Libs/Klib.lib -nostdlib -lgcc
Code: Select all
ENTRY(KeEntry)
SECTIONS {
. = 0xFFFFFFFF80000000;
.text ALIGN(4096) : AT(ADDR(.text)) {
*(.text)
*(.rodata*)
}
.data ALIGN (4096) : AT(ADDR(.data)) {
*(.data)
}
.bss ALIGN (4096) : AT(ADDR(.bss)) {
_sbss = .;
*(.bss)
_ebss = .;
}
end = .; _end = .; __end = .;
}
nexos