I want to set different virtual memory addresses for different sections as you can see in the example code but as I do that the file gets padded with 0s between addresses. I've been trying to find a solution from barebones tutorial, linker script wiki, this forum and ld manual but I can't.
ld does: vaddress1 - 0x7C00, file_offset1: 0x7C00, vaddress2: 0x80000, file_offset2: 0x80000
I want: vaddress1 - 0x7C00, file_offset1: header_size, vaddress2: 0x80000, file_offset2: header_size+section1_size
There has to be a way to force ld to have different virtual addresses and file offsets.
Note: loader.o is assembled from fasm with a couple of org directives.
Code: Select all
start = 0x7C00;
ENTRY (start)
OUTPUT_FORMAT (elf64-x86-64)
SECTIONS
{
.loader (0x7C00) : {
*(.flat)
}
. = 0x80000;
.kernel : {
*(.text)
*(.eh_frame)
}
}
Luís