Browse Source

linker.ld: Make sure all ELF sections are page-aligned

master
3moon 8 years ago
parent
commit
27ead2f20b
1 changed files with 35 additions and 5 deletions
  1. +35
    -5
      src/arch/x86_64/linker.ld

+ 35
- 5
src/arch/x86_64/linker.ld View File

@ -3,21 +3,51 @@ ENTRY(start)
SECTIONS {
. = 1M; /* load the kernel at 1MiB above 0x0 */
.boot : {
/* Merged section for both the multiboot header and .rodata,
so we don't waste a page on the multiboot header */
.rodata : {
/* ensure the multiboot header is at the start of the binary */
KEEP(*(.multiboot_header))
/* ensure small fragments in .rodata and .rel.ro are linked together */
*(.rodata .rodata.*)
. = ALIGN(4K);
}
.text : {
/* Kernel code */
*(.text .text.*) /* .text.* ensures that all small .text fragments are linked together */
. = ALIGN(4K);
}
/* ensure small fragments in .rodata and .rel.ro are linked together */
.rodata : {
*(.rodata .rodata.*)
.data : {
*(.data .data.*)
. = ALIGN(4K);
}
.bss : {
*(.bss .bss.*)
. = ALIGN(4K);
}
.data.rel.ro : {
.got : {
*(.got)
. = ALIGN(4K);
}
.got.plt : {
*(.got.plt)
. = 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);
}
}

Loading…
Cancel
Save