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
16 #if !(ENV_X86 && ENV_BOOTBLOCK)
23 KEEP(*(.metadata_hash_anchor));
28 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
29 _cbmem_init_hooks = .;
30 KEEP(*(.rodata.cbmem_init_hooks_early));
31 KEEP(*(.rodata.cbmem_init_hooks));
32 _ecbmem_init_hooks = .;
33 RECORD_SIZE(cbmem_init_hooks)
36 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
39 _ersbe_init_begin = .;
40 RECORD_SIZE(rsbe_init_begin)
43 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
45 KEEP(*(.rodata.pci_driver));
47 RECORD_SIZE(pci_drivers)
48 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
50 KEEP(*(.rodata.cpu_driver));
52 RECORD_SIZE(cpu_drivers)
55 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
58 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
63 #if ENV_RAMSTAGE && (CONFIG(COVERAGE) || CONFIG(ASAN_IN_RAMSTAGE))
74 /* Include data, bss, and heap in that order. Not defined for all stages. */
75 #if !ENV_SEPARATE_DATA_AND_BSS
77 . = ALIGN(ARCH_CACHELINE_ALIGN_SIZE);
81 * The postcar phase uses a stack value that is located in the relocatable
82 * module section. While the postcar stage could be linked like smm and
83 * other rmodules the postcar stage needs similar semantics of the more
84 * traditional stages in the coreboot infrastructure. Therefore it's easier
85 * to specialize this case.
87 #if ENV_RMODULE || ENV_POSTCAR
89 KEEP(*(.module_parameters));
91 RECORD_SIZE(rmodule_params)
99 #if ENV_ROMSTAGE_OR_BEFORE
100 PROVIDE(_preram_cbmem_console = .);
101 PROVIDE(_epreram_cbmem_console = _preram_cbmem_console);
102 PROVIDE(_preram_cbmem_console_size = ABSOLUTE(0));
104 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
110 RECORD_SIZE(bs_init_begin)
113 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
119 #if !ENV_SEPARATE_DATA_AND_BSS
121 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
127 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
133 #if ENV_HAS_HEAP_SECTION
135 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
137 . += CONFIG_HEAP_SIZE;
138 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
144 #if ENV_RAMSTAGE && CONFIG(ASAN_IN_RAMSTAGE)
145 _shadow_size = (_eheap - _data) >> 3;
146 REGION(asan_shadow, ., _shadow_size, ARCH_POINTER_ALIGN_SIZE)
152 /* The stage cache drops CONFIG_HEAP_SIZE bytes from the end of the in-memory
153 image of the ramstage, so ensure that when moving that many bytes backwards
154 from the program end, we're in the heap (or later), in some region that
155 doesn't contain initialized code or data. */
157 _bogus = ASSERT(_eprogram - CONFIG_HEAP_SIZE >= _heap,
158 "HEAP_SIZE and heap misaligned");
161 /* Discard the sections we don't need/want */