2 * This file is part of the coreboot project.
4 * Copyright 2015 Google Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #include <memlayout.h>
18 /* This file is included inside a SECTIONS block */
20 /* First we place the code and read only data (typically const declared).
21 * This could theoretically be placed in rom.
22 * The '.' in '.text . : {' is actually significant to prevent missing some
23 * SoC's entry points due to artificial alignment restrictions, see
24 * https://sourceware.org/binutils/docs/ld/Output-Section-Address.html
30 * The .rom.* sections are to acommodate x86 romstage. romcc as well
31 * as the assembly files put their text and data in these sections.
41 #if ENV_RAMSTAGE || ENV_ROMSTAGE || ENV_POSTCAR
42 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
43 _cbmem_init_hooks = .;
44 KEEP(*(.rodata.cbmem_init_hooks));
45 _ecbmem_init_hooks = .;
48 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
51 _ersbe_init_begin = .;
54 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
56 KEEP(*(.rodata.pci_driver));
58 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
60 KEEP(*(.rodata.cpu_driver));
64 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
67 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
71 #if ENV_RAMSTAGE && IS_ENABLED(CONFIG_COVERAGE)
82 /* Include data, bss, and heap in that order. Not defined for all stages. */
83 #if ARCH_STAGE_HAS_DATA_SECTION
85 . = ALIGN(ARCH_CACHELINE_ALIGN_SIZE);
89 * The postcar phase uses a stack value that is located in the relocatable
90 * module section. While the postcar stage could be linked like smm and
91 * other rmodules the postcar stage needs similar semantics of the more
92 * traditional stages in the coreboot infrastructure. Therefore it's easier
93 * to specialize this case.
95 #if ENV_RMODULE || ENV_POSTCAR
97 KEEP(*(.module_parameters));
107 PROVIDE(_preram_cbmem_console = .);
108 PROVIDE(_epreram_cbmem_console = _preram_cbmem_console);
110 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
118 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
123 #if ARCH_STAGE_HAS_BSS_SECTION
125 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
131 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
136 #if ARCH_STAGE_HAS_HEAP_SECTION
138 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
140 . += (ENV_RMODULE ? __heap_size : CONFIG_HEAP_SIZE);
141 . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
148 /* Discard the sections we don't need/want */