From b84a680c7fd9c461ac00633ceae3ef41b9d287e3 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 15 Sep 2019 00:17:15 +0200 Subject: Fixed linker --- src/linker.ld | 56 +++++++++++++++++++++++--------------------------------- 1 file changed, 23 insertions(+), 33 deletions(-) (limited to 'src/linker.ld') diff --git a/src/linker.ld b/src/linker.ld index 10315a5..6461b2b 100644 --- a/src/linker.ld +++ b/src/linker.ld @@ -1,35 +1,25 @@ -/* Specify entry for bootloader */ -ENTRY(_start) - -/* Specify position of object files in kernel image */ +OUTPUT_FORMAT("binary") +ENTRY(start) +phys = 0x00100000; SECTIONS { - /* Start at 1MiB */ - . = 1M; - - /* First multiboot header then text section */ - .text BLOCK(4K) : ALIGN(4K) - { - *(.multiboot) - *(.text) - } - - /* Read-only data */ - .rodata BLOCK(4K) : ALIGN(4K) - { - *(.rodata) - } - - /* Read-write data (initialized) */ - .data BLOCK(4K) : ALIGN(4K) - { - *(.data) - } - - /* Read-write data (uninitialized) and stack */ - .bss BLOCK(4K) : ALIGN(4K) - { - *(COMMON) - *(.bss) - } -} \ No newline at end of file + .text phys : AT(phys) { + code = .; + *(.text) + *(.rodata*) + . = ALIGN(4096); + } + .data : AT(phys + (data - code)) + { + data = .; + *(.data) + . = ALIGN(4096); + } + .bss : AT(phys + (bss - code)) + { + bss = .; + *(.bss) + . = ALIGN(4096); + } + end = .; +} -- cgit v1.2.3