]> git.dujemihanovic.xyz Git - nameless-os.git/blob - kernel/linker.ld
Merge branch 'drive'
[nameless-os.git] / kernel / linker.ld
1 ENTRY(_start)
2 OUTPUT_FORMAT(binary)
3
4 SECTIONS
5 {
6 . = 0x100000;
7 __KERNEL_BASE__ = .;
8
9 .text : ALIGN(4K) {
10 kernel/entry.o (.text)
11 *(.text)
12 }
13 .rodata : ALIGN(4K) { *(.rodata) }
14
15 /* .rodata is put after .text so that the read-only entry in the program
16 * header covers .rodata as well. When .rodata is after .data, that entry
17 * only covers .text, leaving .rodata in the writable program header
18 * entry. The problem with this approach is that the program header
19 * entry where .text and .rodata are is marked as executable, which
20 * would mean that .rodata should be executable too, but that doesn't
21 * matter yet because we (currently) assume that the NX bit is not
22 * supported anyway. */
23
24 .data : ALIGN(4K) { *(.data) }
25 .bss : ALIGN(4K) {
26 *(.bss)
27 /* Reserving 16KiB for the stack. A __STACK_TOP__ is not really
28 * needed (yet). */
29 . += 16K;
30 __STACK_BOTTOM__ = .;
31 }
32 }