aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2024-04-05 09:00:06 +0200
committerArthur Heymans <arthur@aheymans.xyz>2024-04-08 00:02:18 +0000
commit8406fb4e271d2f47a3a73f24500912aec2896806 (patch)
treef848449d18973678dee7bfe4bd2d280f6d801f1f
parente27a26bdefdee6fda89dbd8228cc123dfd95859e (diff)
lib/program.ld: Account for large code model sections
Starting with version 18 LLVM puts code and data generated with -ffunction-section -mcmodel=large inside sections with an 'l' prefix. Change-Id: Ib755673dfa9e71172bbef0a5aec075154c89a97b Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81675 Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de> Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/arch/x86/car.ld4
-rw-r--r--src/lib/program.ld13
2 files changed, 17 insertions, 0 deletions
diff --git a/src/arch/x86/car.ld b/src/arch/x86/car.ld
index 8e1af15df3..f99304f396 100644
--- a/src/arch/x86/car.ld
+++ b/src/arch/x86/car.ld
@@ -72,6 +72,8 @@
/* Allow global uninitialized variables for stages without CAR teardown. */
*(.bss)
*(.bss.*)
+ *(.lbss)
+ *(.lbss.*)
*(.sbss)
*(.sbss.*)
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
@@ -97,6 +99,8 @@ _bogus = ASSERT(_etext == ALIGN(_etext, ARCH_POINTER_ALIGN_SIZE), "Cache-As-RAM
_data = .;
*(.data);
*(.data.*);
+ *(.ldata);
+ *(.ldata.*);
*(.sdata);
*(.sdata.*);
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
diff --git a/src/lib/program.ld b/src/lib/program.ld
index 178444733c..b3ddc0b762 100644
--- a/src/lib/program.ld
+++ b/src/lib/program.ld
@@ -10,6 +10,11 @@
* SoC's entry points due to artificial alignment restrictions, see
* https://sourceware.org/binutils/docs/ld/Output-Section-Address.html
*/
+
+/* Starting with version 18 LLVM the combination -ffunction-section -mcmodel=large
+ * puts code and data in '.ltext, '.lrodata', '.ldata' and '.lbss'
+ */
+
.text . : {
_program = .;
_text = .;
@@ -23,6 +28,8 @@
KEEP(*(.metadata_hash_anchor));
*(.text);
*(.text.*);
+ *(.ltext);
+ *(.ltext.*);
#if ENV_HAS_CBMEM
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
@@ -55,6 +62,8 @@
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
*(.rodata);
*(.rodata.*);
+ *(.lrodata);
+ *(.lrodata.*);
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_etext = .;
RECORD_SIZE(text)
@@ -93,6 +102,8 @@
*(.data);
*(.data.*);
+ *(.ldata);
+ *(.ldata.*);
*(.sdata);
*(.sdata.*);
@@ -122,6 +133,8 @@
_bss = .;
*(.bss)
*(.bss.*)
+ *(.lbss)
+ *(.lbss.*)
*(.sbss)
*(.sbss.*)
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);