implement rodata and bss sections

This commit is contained in:
mykola2312 2024-08-04 15:06:26 +03:00
parent 3aca81ddd4
commit 7e35407942
2 changed files with 9 additions and 2 deletions

View file

@ -5,6 +5,8 @@ MEMORY
RESERVED (R) : ORIGIN = 0x01BC, LENGTH = 2 RESERVED (R) : ORIGIN = 0x01BC, LENGTH = 2
PTABLE (R) : ORIGIN = 0x01BE, LENGTH = 64 PTABLE (R) : ORIGIN = 0x01BE, LENGTH = 64
MBR_MAGIC (R) : ORIGIN = 0x01FE, LENGTH = 2 MBR_MAGIC (R) : ORIGIN = 0x01FE, LENGTH = 2
RAM (RWX) : ORIGIN = 0x7E00, LENGTH = 492032
} }
SECTIONS SECTIONS
@ -13,7 +15,7 @@ SECTIONS
.text : { .text : {
BOOTLOADER_START = .; BOOTLOADER_START = .;
*(.text) *(.text)
*(.data) *(.rodata)
BOOTLOADER_END = .; BOOTLOADER_END = .;
BOOTLOADER_SIZE = BOOTLOADER_END - BOOTLOADER_START; BOOTLOADER_SIZE = BOOTLOADER_END - BOOTLOADER_START;
} > BOOTLOADER } > BOOTLOADER
@ -29,6 +31,11 @@ SECTIONS
.mbr_magic : { .mbr_magic : {
SHORT(0xAA55) SHORT(0xAA55)
} > MBR_MAGIC } > MBR_MAGIC
.bss : {
*(.data)
*(.bss)
} > RAM
} }
OUTPUT_FORMAT(binary) OUTPUT_FORMAT(binary)

View file

@ -36,5 +36,5 @@
.halt: .halt:
jmp .halt jmp .halt
.section .data .section .rodata
msg: .asciz "Test MBR hello world\r\n" msg: .asciz "Test MBR hello world\r\n"