Add some stuff to help with using C in link.ld

This commit is contained in:
2025-12-21 19:38:32 +01:00
parent 6c39a5eef2
commit a2d4dec417

21
link.ld
View File

@@ -1,22 +1,31 @@
ENTRY(_start) ENTRY(_start)
SECTIONS { MEMORY {
. = 0x80000000; RAM (rwx) : ORIGIN = 0x80000000, LENGTH = 1M
}
SECTIONS {
.text : ALIGN(4) { .text : ALIGN(4) {
*(.text._start)
*(.text*) *(.text*)
} } > RAM
.rodata : ALIGN(8) { .rodata : ALIGN(8) {
*(.rodata*) *(.rodata*)
} } > RAM
.data : ALIGN(8) { .data : ALIGN(8) {
_data = .;
*(.data*) *(.data*)
} _edata = .;
} > RAM
.bss : ALIGN(8) { .bss : ALIGN(8) {
_bss = .;
*(.bss*) *(.bss*)
*(COMMON) *(COMMON)
} _ebss = .;
} > RAM
_stack_top = ORIGIN(RAM) + LENGTH(RAM);
} }