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