As you probably know given some of my recent questions, I am trying to convert to a 64 bit kernel. I have the cross-compiled version of ld.
When I link at my 'old' kernel's address of 0xC0000000, for some reason I get 2MB added to my output file. An objdump shows the following program and section headers:
Code: Select all
Program Header:
LOAD off 0x0000000000200000 vaddr 0x00000000c0000000 paddr 0x00000000c0000000 align 2**21
filesz 0x0000000000002000 memsz 0x0000000000002000 flags rwx
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00001000 00000000c0000000 00000000c0000000 00200000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .eh_frame 00000030 00000000c0001000 00000000c0001000 00201000 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .data 00000fd0 00000000c0001030 00000000c0001030 00201030 2**2
CONTENTS, ALLOC, LOAD, DATA
3 .comment 00000012 0000000000000000 0000000000000000 00202000 2**0
CONTENTS, READONLY#
I have attempted using the following linker script, but have tried without too. If I do not specify the load address, everything is fine (the file size is a few hundred bytes), but the load address is 0x400000, which I don't really want.
Linker script follows:
Code: Select all
ENTRY(runtime);
OUTPUT_FORMAT(x86_64-pc-elf);
phys = 0xC0000000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
*(.rodata)
start_ctors = .;
*(.ctor*)
end_ctors = .;
start_dtors = .;
*(.dtor*)
end_dtors = .;
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
. = ALIGN(4096);
end = .;
}
Cheers,
Adam[/code]