1 /* SPDX-License-Identifier: GPL-2.0-only */
5 /* This file is included inside a SECTIONS block */
7 /* First we place the code and read only data (typically const declared).
8 * This could theoretically be placed in rom.
9 * The '.' in '.text . : {' is actually significant to prevent missing some
10 * SoC's entry points due to artificial alignment restrictions, see
11 * https://sourceware.org/binutils/docs/ld/Output-Section-Address.html
14 /* Starting with version 18 LLVM the combination -ffunction-section -mcmodel=large
15 * puts code and data in '.ltext, '.lrodata', '.ldata' and '.lbss'
21 #if !(ENV_X86 && ENV_BOOTBLOCK)
28 KEEP(*(.metadata_hash_anchor));
35 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
36 _cbmem_init_hooks = .;
37 KEEP(*(.rodata.cbmem_init_hooks_early));
38 KEEP(*(.rodata.cbmem_init_hooks));
39 _ecbmem_init_hooks = .;
40 RECORD_SIZE(cbmem_init_hooks)
43 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
46 _ersbe_init_begin = .;
47 RECORD_SIZE(rsbe_init_begin)
50 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
52 KEEP(*(.rodata.pci_driver));
54 RECORD_SIZE(pci_drivers)
55 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
57 KEEP(*(.rodata.cpu_driver));
59 RECORD_SIZE(cpu_drivers)
62 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
67 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
72 #if ENV_RAMSTAGE && (CONFIG(COVERAGE) || CONFIG(ASAN_IN_RAMSTAGE))
83 /* Include data, bss, and heap in that order. Not defined for all stages. */
84 #if !ENV_SEPARATE_DATA_AND_BSS
86 . = ALIGN(ARCH_CACHELINE_ALIGN_SIZE);
90 * The postcar phase uses a stack value that is located in the relocatable
91 * module section. While the postcar stage could be linked like smm and
92 * other rmodules the postcar stage needs similar semantics of the more
93 * traditional stages in the coreboot infrastructure. Therefore it's easier
94 * to specialize this case.
96 #if ENV_RMODULE || ENV_POSTCAR
98 KEEP(*(.module_parameters));
100 RECORD_SIZE(rmodule_params)
110 #if ENV_ROMSTAGE_OR_BEFORE
111 PROVIDE(_preram_cbmem_console = .);
112 PROVIDE(_epreram_cbmem_console = _preram_cbmem_console);
113 PROVIDE(_preram_cbmem_console_size = ABSOLUTE(0));
115 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
121 RECORD_SIZE(bs_init_begin)
124 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
130 #if !ENV_SEPARATE_DATA_AND_BSS
132 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
140 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
146 #if ENV_HAS_HEAP_SECTION
148 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
150 . += CONFIG_HEAP_SIZE;
151 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
157 #if ENV_RAMSTAGE && CONFIG(ASAN_IN_RAMSTAGE)
158 _shadow_size = (_eheap - _data) >> 3;
159 REGION(asan_shadow, ., _shadow_size, ARCH_POINTER_ALIGN_SIZE)
165 /* The stage cache drops CONFIG_HEAP_SIZE bytes from the end of the in-memory
166 image of the ramstage, so ensure that when moving that many bytes backwards
167 from the program end, we're in the heap (or later), in some region that
168 doesn't contain initialized code or data. */
170 _bogus = ASSERT(_eprogram - CONFIG_HEAP_SIZE >= _heap,
171 "HEAP_SIZE and heap misaligned");
174 /* Discard the sections we don't need/want */