Code: Select all
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
KERN_LMA = 0x100000;
KERN_VMA = 0xFFFF800000000000;
PHDRS {
boot PT_LOAD;
text PT_LOAD;
data PT_LOAD;
}
SECTIONS {
. = KERN_LMA;
kernel_start = .;
.boot : AT(ADDR(.boot)) {
*(.boot)
} : boot
. += KERN_VMA;
. = ALIGN(4096);
.text : AT(ADDR(.text) - KERN_VMA) {
text = . - KERN_VMA;
*(.text)
*(.rodata*)
. = ALIGN(4096);
} : text
.data : AT(ADDR(.data) - KERN_VMA) {
data = . - KERN_VMA;
*(.data)
. = ALIGN(4096);
} : data
.ehframe : AT(ADDR(.ehframe) - KERN_VMA) {
ehframe = . - KERN_VMA;
*(.ehframe)
. = ALIGN(4096);
} : data
.bss : AT(ADDR(.bss) - KERN_VMA) {
bss = . - KERN_VMA;
*(.bss)
*(COMMON)
} : data
/* end of kernel :) */
kernel_end = .;
/DISCARD/ : {
*(.comment)
}
/*. = ASSERT(end <= 0x400000, "linker.ld: Kernel too big!!!");*/
}