From 103e950aefe06985200a56b5029074dc6bbff926 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 19 Apr 2024 18:17:51 +0200 Subject: [PATCH] Add missing assert to link.ld to make sure important code doesn't get overwritten --- src/link.ld | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/link.ld b/src/link.ld index 1fcfe61..c88244b 100644 --- a/src/link.ld +++ b/src/link.ld @@ -7,6 +7,8 @@ SECTIONS { .text : { *(.kernel_code*); *(.start_code*); + start_code_end = .; + /* everything below this code may get overwritten at runtime */ *(.text*); /* Tell linker to not garbage collect this section as it is not referenced anywhere */ KEEP(*(.kernel_code*)); @@ -24,4 +26,5 @@ SECTIONS { } } -ASSERT((SIZEOF(.text) + SIZEOF(.data)) < (0x00900000 - 0x00808000), "elf is too big"); \ No newline at end of file +ASSERT((SIZEOF(.text) + SIZEOF(.data)) < (0x00900000 - 0x00808000), "elf is too big"); +ASSERT(start_code_end <= 0x00809000, "start_code section is too big"); \ No newline at end of file