relocation truncated to fit: R_X86_64_32S
Posted: Mon Nov 09, 2015 12:41 am
EDIT: Solved, thank-you John.
Hi all, I have search this on the Wiki and google.
I am implementing a new exception handler in user space and this error is happening.
A nudge or a kick in the right direction would be appreciated.
Edit: There are no linked files.
Here is the code, I am trying to get the label address.
It compiles in the Kernel which is loaded under 4GB.
This line breaks it??? asm volatile ("mov ExceptionLabel, %rax;");
Here is linked.ld
The compiler:
The linker:
Hi all, I have search this on the Wiki and google.
I am implementing a new exception handler in user space and this error is happening.
A nudge or a kick in the right direction would be appreciated.
Edit: There are no linked files.
Here is the code, I am trying to get the label address.
It compiles in the Kernel which is loaded under 4GB.
This line breaks it??? asm volatile ("mov ExceptionLabel, %rax;");
Code: Select all
#define DEBUG 1
#undef RELEASE
#else
#define RELEASE 1
#undef DEBUG
#endif
#pragma GCC diagnostic ignored "-Wunused-label";
extern "C" void StartKernel(void) /*!!__attribute__((section(".StartKernel")))!!*/;
char FileEnd /*!!__attribute__((section(".FileEnd")))!!*/;
void StartKernel(void)
{
// Header for Kernel, nice and simple
QWORD pStartKernel = (QWORD)&StartKernel;
asm volatile (";" : : "a" (pStartKernel), "b"(&FileEnd));
// End of header
while (true)
{
asm volatile ("mov ExceptionLabel, %rax;");
ExceptionLabel:
asm volatile ("ExceptionLabel:");
}
}
Code: Select all
ENTRY(StartKernel)
SECTIONS
{
. = 0x170000000000;
.GDT 0x5000 (NOLOAD) :
{
*(.GDT)
}
.LocalAPICAddress 0x48A0 (NOLOAD) :
{
*(.LocalAPICAddress)
}
.DefaultExceptionHandler14 0x48A8 (NOLOAD) :
{
*(.DefaultExceptionHandler14)
}
.DefaultExceptionHandler0 0x48B0 (NOLOAD) :
{
*(.DefaultExceptionHandler0)
}
.DefaultExceptionHandler19 0x48B8 (NOLOAD) :
{
*(.DefaultExceptionHandler19)
}
.CPU_ExceptionHandler_RecoveryCodePointer 0x30000 (NOLOAD) :
{
*(.CPU_ExceptionHandler_RecoveryCodePointer)
}
.StartKernel 0x170000000000 :
{
*(.StartKernel)
}
.UserData :
{
. = ALIGN(16);
*(.UserData)
}
.text :
{
. = ALIGN(16);
*(.text)
}
.rodata :
{
. = ALIGN(16);
*(.rodata)
}
.bss :
{
. = ALIGN(16);
*(COMMON)
*(.bss)
}
.staticmemory (NOLOAD) :
{
. = ALIGN(16);
*(.staticmemory)
}
.FileEnd (NOLOAD) :
{
*(.FileEnd)
}
}
Code: Select all
x86_64-elf-g++ -c 192_168_99_44.cpp -o 192_168_99_44.o -ffast-math -fno-exceptions -mcmodel=large -fno-rtti -ffreestanding -mno-red-zone -Ofast -Wall -Wextra -nostdlib -m64 -std=c++11 -msse3 -msse2 -mmmx -msse -mno-3dnow -fstrength-reduce -fomit-frame-pointer -finline-functions -fno-tree-loop-distribute-patterns -funroll-loops 2> Compile.txt
Code: Select all
x86_64-elf-g++ -T linker.ld -o 192_168_99_44.lkr 192_168_99_44.o -lgcc -nostdlib -fno-use-linker-plugin 2> Linker.txt