From a7f28c50e1c8f13de365359022336c04195ef4c5 Mon Sep 17 00:00:00 2001 From: Sam Tebbs Date: Fri, 19 Apr 2019 21:10:27 +0100 Subject: [PATCH] Add higher half support in linker script --- link.ld | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/link.ld b/link.ld index 85aca9f..026236d 100644 --- a/link.ld +++ b/link.ld @@ -1,23 +1,45 @@ ENTRY(_start) +KERNEL_ADDR_OFFSET = 0xC0000000; + SECTIONS { . = 1M; + KERNEL_PHYSADDR_START = .; - .text : ALIGN(4K) { - KEEP(*(.multiboot)) + .rodata.boot : { + *(.rodata.boot) + } + + .text.boot : { + *(.text.boot) + } + + . = KERNEL_ADDR_OFFSET; + KERNEL_VADDR_START = .; + + .text ALIGN(4K) : AT (ADDR(.text) - KERNEL_ADDR_OFFSET) { *(.text) } - .rodata : ALIGN(4K) { + .rodata ALIGN(4K) : AT (ADDR(.rodata) - KERNEL_ADDR_OFFSET) { *(.rodata) } - .data : ALIGN(4K) { + .data ALIGN(4K) : AT (ADDR(.data) - KERNEL_ADDR_OFFSET) { *(.data) } - .bss : ALIGN(4K) { + .bss ALIGN(4K) : AT (ADDR(.bss) - KERNEL_ADDR_OFFSET) { *(COMMON) *(.bss) } -} \ No newline at end of file + + .bss.stack ALIGN(4K) : AT (ADDR(.bss.stack) - KERNEL_ADDR_OFFSET) { + *(.bss.stack) + KERNEL_STACK_END = .; + } + + KERNEL_VADDR_END = .; + KERNEL_PHYSADDR_END = . - KERNEL_ADDR_OFFSET; + +}