diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-03-25 22:37:33 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-03-25 22:37:33 +0200 |
commit | bf69f336c3fb680e31a5bb43450739b0b06d95e1 (patch) | |
tree | 2e14ca86442c5aafa40c3a436c0596327faaee85 /src/linker.ld | |
parent | makefile: add clang-tidy target (diff) | |
download | kernel.cpp-bf69f336c3fb680e31a5bb43450739b0b06d95e1.tar.xz |
makefile: make makefile recursive
Diffstat (limited to 'src/linker.ld')
-rw-r--r-- | src/linker.ld | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/linker.ld b/src/linker.ld new file mode 100644 index 0000000..8eba287 --- /dev/null +++ b/src/linker.ld @@ -0,0 +1,61 @@ +ENTRY(_start) +OUTPUT_FORMAT(elf32-i386) + +VADDR_BASE = 0xc0000000; + +SECTIONS +{ + /* + * First put the multiboot header, as it is required to be put very early + * early in the image or the bootloader won't recognize the file format. + */ + . = 0; + .multiboot : { + . = ALIGN(8); + begin_multiboot = .; + KEEP(*(.multiboot.header)) + *(.multiboot.text) + *(.multiboot.pages)) + end_multiboot = .; + } + + /* Begin putting sections at 4 MiB */ + . = VADDR_BASE; + + .text ALIGN(4K) : AT(ADDR(.text) - VADDR_BASE + 4M) { + begin_text = .; + *(.text*) + end_text = .; + } + + /* Read-only data. */ + .rodata ALIGN(4K) : AT(ADDR(.rodata) - VADDR_BASE + 4M) { + begin_rodata = .; + *(.rodata*) + end_rodata = .; + } + + /* Read-write data (initialized) */ + .data ALIGN(4K) : AT(ADDR(.data) - VADDR_BASE + 4M) { + begin_data = .; + begin_constinit = .; + *(.constinit) + end_constinit = .; + + begin_ctors = .; + KEEP(*(.init_array)); /* global constructors */ + end_ctors = .; + + *(.data) + end_data = .; + } + + /* Read-write data (uninitialized) and stack */ + .bss ALIGN(4K) : AT(ADDR(.bss) - VADDR_BASE + 4M) { + begin_bss = .; + *(.pages) + *(.bss*) + *(.stack) + end_bss = .; + } +} |