From 8df3b96402d1d35a4de928aaaca9f08018932fa3 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 24 Jun 2025 14:40:18 +0100 Subject: [PATCH] [build] Allow for the existence of small-data sections Signed-off-by: Michael Brown --- src/arch/i386/scripts/i386-kir.lds | 6 ++++++ src/arch/riscv/scripts/sbi.lds | 6 ++++++ src/arch/x86/scripts/pcbios.lds | 6 ++++++ src/scripts/efi.lds | 6 ++++++ src/scripts/linux.lds | 6 ++++++ 5 files changed, 30 insertions(+) diff --git a/src/arch/i386/scripts/i386-kir.lds b/src/arch/i386/scripts/i386-kir.lds index 13c36f2bf..4cb656000 100644 --- a/src/arch/i386/scripts/i386-kir.lds +++ b/src/arch/i386/scripts/i386-kir.lds @@ -88,6 +88,8 @@ SECTIONS { __rodata16 = .; *(.rodata16) *(.rodata16.*) + *(.srodata) + *(.srodata.*) *(.rodata) *(.rodata.*) } @@ -95,6 +97,8 @@ SECTIONS { __data16 = .; *(.data16) *(.data16.*) + *(.sdata) + *(.sdata.*) *(.data) *(.data.*) KEEP(*(SORT(.tbl.*))) /* Various tables. See include/tables.h */ @@ -107,6 +111,8 @@ SECTIONS { _bss16 = .; *(.bss16) *(.bss16.*) + *(.sbss) + *(.sbss.*) *(.bss) *(.bss.*) *(COMMON) diff --git a/src/arch/riscv/scripts/sbi.lds b/src/arch/riscv/scripts/sbi.lds index 9fec07ecb..04cabcf85 100644 --- a/src/arch/riscv/scripts/sbi.lds +++ b/src/arch/riscv/scripts/sbi.lds @@ -38,6 +38,8 @@ SECTIONS { /* Read-only data */ .rodata : { _rodata = .; + *(.srodata) + *(.srodata.*) *(.rodata) *(.rodata.*) _erodata = .; @@ -46,6 +48,8 @@ SECTIONS { /* Writable data */ .data : { _data = .; + *(.sdata) + *(.sdata.*) *(.data) *(.data.*) KEEP(*(SORT(.tbl.*))) /* Various tables. See include/tables.h */ @@ -78,6 +82,8 @@ SECTIONS { /* Uninitialised data */ .bss { _bss = .; + *(.sbss) + *(.sbss.*) *(.bss) *(.bss.*) *(COMMON) diff --git a/src/arch/x86/scripts/pcbios.lds b/src/arch/x86/scripts/pcbios.lds index e208b174b..f8c137283 100644 --- a/src/arch/x86/scripts/pcbios.lds +++ b/src/arch/x86/scripts/pcbios.lds @@ -130,8 +130,12 @@ SECTIONS { . += 1; /* Prevent NULL being valid */ *(.text) *(.text.*) + *(.srodata) + *(.srodata.*) *(.rodata) *(.rodata.*) + *(.sdata) + *(.sdata.*) *(.data) *(.data.*) KEEP(*(SORT(.tbl.*))) /* Various tables. See include/tables.h */ @@ -139,6 +143,8 @@ SECTIONS { KEEP(*(.provided.*)) _mtextdata = .; } .bss.textdata (NOLOAD) : AT ( _bss_textdata_lma ) { + *(.sbss) + *(.sbss.*) *(.bss) *(.bss.*) *(COMMON) diff --git a/src/scripts/efi.lds b/src/scripts/efi.lds index 218b1df66..a3b2c29d2 100644 --- a/src/scripts/efi.lds +++ b/src/scripts/efi.lds @@ -39,6 +39,8 @@ SECTIONS { . = ALIGN ( _page_align ); .rodata : { _rodata = .; + *(.srodata) + *(.srodata.*) *(.rodata) *(.rodata.*) _erodata = .; @@ -52,6 +54,8 @@ SECTIONS { . = ALIGN ( _page_align ); .data : { _data = .; + *(.sdata) + *(.sdata.*) *(.data) *(.data.*) KEEP(*(SORT(.tbl.*))) /* Various tables. See include/tables.h */ @@ -68,6 +72,8 @@ SECTIONS { . = ALIGN ( _page_align ); .bss : { _bss = .; + *(.sbss) + *(.sbss.*) *(.bss) *(.bss.*) *(COMMON) diff --git a/src/scripts/linux.lds b/src/scripts/linux.lds index 53e884ec5..f9128954b 100644 --- a/src/scripts/linux.lds +++ b/src/scripts/linux.lds @@ -29,6 +29,8 @@ SECTIONS { . = ALIGN ( _max_align ); .rodata : { _rodata = .; + *(.srodata) + *(.srodata.*) *(.rodata) *(.rodata.*) _erodata = .; @@ -45,6 +47,8 @@ SECTIONS { . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); .data : { _data = .; + *(.sdata) + *(.sdata.*) *(.data) *(.data.*) KEEP(*(SORT(.tbl.*))) @@ -61,6 +65,8 @@ SECTIONS { . = ALIGN ( _max_align ); .bss : { _bss = .; + *(.sbss) + *(.sbss.*) *(.bss) *(.bss.*) *(COMMON) -- 2.47.2