summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordzwdz2022-08-13 19:37:29 +0200
committerdzwdz2022-08-13 19:37:29 +0200
commit8173a2b8e64eade49edf8183713fce9c2bc77dea (patch)
treeb5521551311a37e690720e049480df41ca5c1ddc /src
parentbf8c01d44d0849f40a5a212679315c6f5d84d690 (diff)
user/bootstrap: move .bss before .text
prevents the initrd from overflowing into .bss
Diffstat (limited to 'src')
-rw-r--r--src/user/bootstrap/linker.ld21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/user/bootstrap/linker.ld b/src/user/bootstrap/linker.ld
index ca6356f..d16440c 100644
--- a/src/user/bootstrap/linker.ld
+++ b/src/user/bootstrap/linker.ld
@@ -8,9 +8,20 @@ SECTIONS
_DYNAMIC = 0;
_image_base = 0;
+ . = 0x10000;
+ _bss_start = .;
+ .bss BLOCK(4K) : ALIGN(4K)
+ {
+ *(COMMON)
+ *(.bss)
+ }
+ _bss_end = .;
+
. = 2M;
.text BLOCK(4K) : ALIGN(4K)
{
+ /* the assert needs to be inside of a section or it'll be a syntax error */
+ ASSERT(_bss_end <= 2M, "bss too big, needs to be moved down");
*(.text.startup)
*(.text)
}
@@ -22,17 +33,7 @@ SECTIONS
{
*(.data)
}
-
_initrd = .; /* is just appended onto the end of the binary */
- . += 2M;
-
- _bss_start = .;
- .bss BLOCK(4K) : ALIGN(4K)
- {
- *(COMMON)
- *(.bss)
- }
- _bss_end = .;
/DISCARD/ : {
*(*.rel.*)