Improve linker scripts

This commit is contained in:
Alex Kotov 2022-01-15 23:06:03 +05:00
parent 71f4bf793c
commit 3c34afb931
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 30 additions and 23 deletions

View File

@ -1,14 +1,27 @@
ENTRY(_start); ENTRY(_start);
. = 0x80000000; SECTIONS
{
. = 0x80000000;
SECTIONS { .text : ALIGN(4K)
/* Include entry point at start of binary */ {
.text : ALIGN(4K) {
*(.init); *(.init);
*(.text); *(.text);
} }
.bss : ALIGN(4K) {
.rodata : ALIGN(4K)
{
*(.rodata);
}
.data : ALIGN(4K)
{
*(.data);
}
.bss : ALIGN(4K)
{
PROVIDE(bss_start = .); PROVIDE(bss_start = .);
*(.bss); *(.bss);
. += 4096; . += 4096;
@ -17,10 +30,4 @@ SECTIONS {
PROVIDE(global_pointer = .); PROVIDE(global_pointer = .);
PROVIDE(bss_end = .); PROVIDE(bss_end = .);
} }
.rodata : ALIGN(4K) {
*(.rodata);
}
.data : ALIGN(4K) {
*(.data);
}
} }

View File

@ -14,24 +14,24 @@ SECTIONS
.text BLOCK(4K) : ALIGN(4K) .text BLOCK(4K) : ALIGN(4K)
{ {
*(.multiboot2) *(.multiboot2);
*(.text) *(.text);
} }
.rodata BLOCK(4K) : ALIGN(4K) .rodata BLOCK(4K) : ALIGN(4K)
{ {
*(.rodata) *(.rodata);
} }
.data BLOCK(4K) : ALIGN(4K) .data BLOCK(4K) : ALIGN(4K)
{ {
*(.data) *(.data);
} }
.bss BLOCK(4K) : ALIGN(4K) .bss BLOCK(4K) : ALIGN(4K)
{ {
*(COMMON) *(COMMON);
*(.bss) *(.bss);
} }
_kernel_size = . - _kernel_phys_base; _kernel_size = . - _kernel_phys_base;

View File

@ -14,24 +14,24 @@ SECTIONS
.text BLOCK(4K) : ALIGN(4K) .text BLOCK(4K) : ALIGN(4K)
{ {
*(.multiboot2) *(.multiboot2);
*(.text) *(.text);
} }
.rodata BLOCK(4K) : ALIGN(4K) .rodata BLOCK(4K) : ALIGN(4K)
{ {
*(.rodata) *(.rodata);
} }
.data BLOCK(4K) : ALIGN(4K) .data BLOCK(4K) : ALIGN(4K)
{ {
*(.data) *(.data);
} }
.bss BLOCK(4K) : ALIGN(4K) .bss BLOCK(4K) : ALIGN(4K)
{ {
*(COMMON) *(COMMON);
*(.bss) *(.bss);
} }
_kernel_size = . - _kernel_phys_base; _kernel_size = . - _kernel_phys_base;