diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2025-01-07 04:58:58 -0500 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-01-07 05:04:23 -0500 |
commit | 420c790ef4accce6da00936252e607b9c1b52a0a (patch) | |
tree | d6f9e05c2e7670ce924047f2979c31c39e91d19b | |
parent | bc8de8888205703b92d0f8fb7edecad25c94c0a9 (diff) |
kernel: linker: Generate a reliable kernel_end
-rw-r--r-- | kernel/boot/linker.ld | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/kernel/boot/linker.ld b/kernel/boot/linker.ld index a33d966..5406ff4 100644 --- a/kernel/boot/linker.ld +++ b/kernel/boot/linker.ld @@ -20,6 +20,16 @@ designated as the entry point. */ ENTRY(_start) +PHDRS +{ + /* Flags: Read/Execute + * EXECUTABLE (1 << 0) + * WRITABLE (1 << 1) + * READABLE (1 << 2) + */ + OTHERS PT_LOAD FLAGS (0x5); +} + /* Tell where the various sections of the object files will be put in the final kernel image. */ SECTIONS @@ -45,6 +55,12 @@ SECTIONS { *(.multiboot) *(.text) + + *(.init) + *(.fini) + + *(.ctors) + *(.dtors) } /* Read-only data. */ @@ -66,8 +82,10 @@ SECTIONS *(.bss) } - /* The compiler may produce other sections, by default it will put them in - a segment with the same name. Simply add stuff here as needed. */ -} + .other : ALIGN(4K) + { + *(*) + } : OTHERS -kernel_end = .; + kernel_end = .; +} |