Fix linker RWX warning

This commit is contained in:
2025-07-20 23:17:40 +02:00
parent a5ef7a0906
commit 76b4979067
4 changed files with 23 additions and 19 deletions

37
arch/riscv/kernel.ld Normal file
View File

@@ -0,0 +1,37 @@
OUTPUT_ARCH("riscv")
OUTPUT_FORMAT("elf32-littleriscv")
ENTRY(_entry)
PHDRS {
text PT_LOAD FLAGS(5);
data PT_LOAD FLAGS(6);
}
SECTIONS {
.text 0x80200000 : {
__kernel_base = .;
KEEP(*(.text.boot));
*(.text .text.*);
} :text
.rodata : ALIGN(16) {
*(.rodata .rodata.*);
}
.data : ALIGN(16) {
*(.data .data.*);
} :data
.bss : ALIGN(16) {
__bss = .;
*(.bss .bss.* .sbss .sbss.*);
__bss_end = .;
}
. = ALIGN(4);
. += 128 * 1024; /* 128KB */
__stack_top = .;
. = ALIGN(CONSTANT(MAXPAGESIZE));
__free_ram = .;
}

View File

@@ -1,4 +1,4 @@
.global kernel_main, __bss, __bss_end, __stack_top
.global _entry, __bss, __bss_end, __stack_top
.section .rodata
@@ -215,7 +215,7 @@ panic:
ret
.section .text.boot
boot:
_entry:
la t0, __stack_top
mv sp, t0 # Set the stack pointer