1/* 2 * Copyright (c) 2004-2008 Texas Instruments 3 * 4 * (C) Copyright 2002 5 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> 6 * 7 * SPDX-License-Identifier: GPL-2.0+ 8 */ 9 10#include <config.h> 11#include <asm/psci.h> 12 13OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") 14OUTPUT_ARCH(arm) 15ENTRY(_start) 16SECTIONS 17{ 18#ifndef CONFIG_CMDLINE 19 /DISCARD/ : { *(.u_boot_list_2_cmd_*) } 20#endif 21#if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC) 22 /* 23 * If CONFIG_ARMV7_SECURE_BASE is true, secure code will not 24 * bundle with u-boot, and code offsets are fixed. Secure zone 25 * only needs to be copied from the loading address to 26 * CONFIG_ARMV7_SECURE_BASE, which is the linking and running 27 * address for secure code. 28 * 29 * If CONFIG_ARMV7_SECURE_BASE is undefined, the secure zone will 30 * be included in u-boot address space, and some absolute address 31 * were used in secure code. The absolute addresses of the secure 32 * code also needs to be relocated along with the accompanying u-boot 33 * code. 34 * 35 * So DISCARD is only for CONFIG_ARMV7_SECURE_BASE. 36 */ 37 /DISCARD/ : { *(.rel._secure*) } 38#endif 39 . = 0x00000000; 40 41 . = ALIGN(4); 42 .text : 43 { 44 *(.__image_copy_start) 45 *(.vectors) 46 CPUDIR/start.o (.text*) 47 *(.text*) 48 } 49 50#ifdef CONFIG_ARMV7_NONSEC 51 52 /* Align the secure section only if we're going to use it in situ */ 53 .__secure_start : 54#ifndef CONFIG_ARMV7_SECURE_BASE 55 ALIGN(CONSTANT(COMMONPAGESIZE)) 56#endif 57 { 58 KEEP(*(.__secure_start)) 59 } 60 61#ifndef CONFIG_ARMV7_SECURE_BASE 62#define CONFIG_ARMV7_SECURE_BASE 63#define __ARMV7_PSCI_STACK_IN_RAM 64#endif 65 66 .secure_text CONFIG_ARMV7_SECURE_BASE : 67 AT(ADDR(.__secure_start) + SIZEOF(.__secure_start)) 68 { 69 *(._secure.text) 70 } 71 72 .secure_stack ALIGN(ADDR(.secure_text) + SIZEOF(.secure_text), 73 CONSTANT(COMMONPAGESIZE)) (NOLOAD) : 74#ifdef __ARMV7_PSCI_STACK_IN_RAM 75 AT(ADDR(.secure_stack)) 76#else 77 AT(LOADADDR(.secure_text) + SIZEOF(.secure_text)) 78#endif 79 { 80 KEEP(*(.__secure_stack_start)) 81 82 /* Skip addreses for stack */ 83 . = . + CONFIG_ARMV7_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE; 84 85 /* Align end of stack section to page boundary */ 86 . = ALIGN(CONSTANT(COMMONPAGESIZE)); 87 88 KEEP(*(.__secure_stack_end)) 89 } 90 91#ifndef __ARMV7_PSCI_STACK_IN_RAM 92 /* Reset VMA but don't allocate space if we have secure SRAM */ 93 . = LOADADDR(.secure_stack); 94#endif 95 96 .__secure_end : AT(ADDR(.__secure_end)) { 97 *(.__secure_end) 98 LONG(0x1d1071c); /* Must output something to reset LMA */ 99 } 100#endif 101 102 . = ALIGN(4); 103 .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } 104 105 . = ALIGN(4); 106 .data : { 107 *(.data*) 108 } 109 110 . = ALIGN(4); 111 112 . = .; 113 114 . = ALIGN(4); 115 .u_boot_list : { 116 KEEP(*(SORT(.u_boot_list*))); 117 } 118 119 . = ALIGN(4); 120 121 .__efi_runtime_start : { 122 *(.__efi_runtime_start) 123 } 124 125 .efi_runtime : { 126 *(efi_runtime_text) 127 *(efi_runtime_data) 128 } 129 130 .__efi_runtime_stop : { 131 *(.__efi_runtime_stop) 132 } 133 134 .efi_runtime_rel_start : 135 { 136 *(.__efi_runtime_rel_start) 137 } 138 139 .efi_runtime_rel : { 140 *(.relefi_runtime_text) 141 *(.relefi_runtime_data) 142 } 143 144 .efi_runtime_rel_stop : 145 { 146 *(.__efi_runtime_rel_stop) 147 } 148 149 . = ALIGN(4); 150 151 .image_copy_end : 152 { 153 *(.__image_copy_end) 154 } 155 156 .rel_dyn_start : 157 { 158 *(.__rel_dyn_start) 159 } 160 161 .rel.dyn : { 162 *(.rel*) 163 } 164 165 .rel_dyn_end : 166 { 167 *(.__rel_dyn_end) 168 } 169 170 .end : 171 { 172 *(.__end) 173 } 174 175 _image_binary_end = .; 176 177 /* 178 * Deprecated: this MMU section is used by pxa at present but 179 * should not be used by new boards/CPUs. 180 */ 181 . = ALIGN(4096); 182 .mmutable : { 183 *(.mmutable) 184 } 185 186/* 187 * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c 188 * __bss_base and __bss_limit are for linker only (overlay ordering) 189 */ 190 191 .bss_start __rel_dyn_start (OVERLAY) : { 192 KEEP(*(.__bss_start)); 193 __bss_base = .; 194 } 195 196 .bss __bss_base (OVERLAY) : { 197 *(.bss*) 198 . = ALIGN(4); 199 __bss_limit = .; 200 } 201 202 .bss_end __bss_limit (OVERLAY) : { 203 KEEP(*(.__bss_end)); 204 } 205 206 .dynsym _image_binary_end : { *(.dynsym) } 207 .dynbss : { *(.dynbss) } 208 .dynstr : { *(.dynstr*) } 209 .dynamic : { *(.dynamic*) } 210 .plt : { *(.plt*) } 211 .interp : { *(.interp*) } 212 .gnu.hash : { *(.gnu.hash) } 213 .gnu : { *(.gnu*) } 214 .ARM.exidx : { *(.ARM.exidx*) } 215 .gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) } 216} 217