aboutsummaryrefslogtreecommitdiff
path: root/linker.ld
diff options
context:
space:
mode:
Diffstat (limited to 'linker.ld')
-rw-r--r--linker.ld26
1 files changed, 16 insertions, 10 deletions
diff --git a/linker.ld b/linker.ld
index cd4139c..5ff3b62 100644
--- a/linker.ld
+++ b/linker.ld
@@ -1,31 +1,36 @@
ENTRY(_start)
OUTPUT_FORMAT(elf32-i386)
+VADDR_BASE = 0xc0000000;
+
SECTIONS
{
- /* Begin putting sections at 1 MiB */
- . = 1M;
-
- /* First put the multiboot header, as it is required to be put very early
+ /*
+ * 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;
+ _kernel_start = .;
.multiboot : {
*(.multiboot.header)
*(.multiboot.text)
}
- .text : {
+ /* Begin putting sections at 1 MiB */
+ . = VADDR_BASE + 1M;
+
+ .text ALIGN(4K) : AT(ADDR(.text) - VADDR_BASE) {
*(.text*)
}
/* Read-only data. */
- .rodata : {
+ .rodata ALIGN(4K) : AT(ADDR(.rodata) - VADDR_BASE) {
*(.rodata*)
}
/* Read-write data (initialized) */
- .data : {
- start_ctors = .;
+ .data ALIGN(4K) : AT(ADDR(.data) - VADDR_BASE) {
+ begin_ctors = .;
KEEP(*(.init_array)); /* global constructors */
end_ctors = .;
@@ -37,9 +42,10 @@ SECTIONS
}
/* Read-write data (uninitialized) and stack */
- .bss : {
+ .bss ALIGN(4K) : AT(ADDR(.bss) - VADDR_BASE) {
+ *(.pages)
*(.bss)
*(.stack)
}
-
+ _kernel_end = .;
}