From 635f7d3f9dced752f84d429e1d51f5c2b29854e3 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Sat, 13 Feb 2016 16:59:04 +0100 Subject: [PATCH] Align section size instead of section start due to #126 This fixes the problem that GRUB sometimes puts the multiboot info struct between kernel sections if the hole is big enough. This leads to problems since we would try to map the same page twice in that case. --- src/arch/x86_64/linker.ld | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/arch/x86_64/linker.ld b/src/arch/x86_64/linker.ld index 6d512b63..ff773527 100644 --- a/src/arch/x86_64/linker.ld +++ b/src/arch/x86_64/linker.ld @@ -14,28 +14,39 @@ ENTRY(start) SECTIONS { . = 1M; - .rodata : ALIGN(4K) + .rodata : { /* ensure that the multiboot header is at the beginning */ KEEP(*(.multiboot_header)) *(.rodata .rodata.*) + . = ALIGN(4K); } - .text : ALIGN(4K) + .text : { *(.text .text.*) + . = ALIGN(4K); } - .data : ALIGN(4K) + .data : { *(.data .data.*) + . = ALIGN(4K); + } + + .bss : + { + *(.bss .bss.*) + . = ALIGN(4K); } .data.rel.ro : ALIGN(4K) { *(.data.rel.ro.local*) *(.data.rel.ro .data.rel.ro.*) + . = ALIGN(4K); } .gcc_except_table : ALIGN(4K) { *(.gcc_except_table) + . = ALIGN(4K); } }