blob: fb6a30c922f724026d7b89b0403b3145a4559c77 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
David Feng85fd5f12013-12-14 11:47:35 +08002/*
3 * (C) Copyright 2013
4 * David Feng <fenghua@phytium.com.cn>
5 *
6 * (C) Copyright 2002
7 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
David Feng85fd5f12013-12-14 11:47:35 +08008 */
9
macro.wave.z@gmail.com01bd3342016-12-08 11:58:22 +080010#include <config.h>
11#include <asm/psci.h>
12
David Feng85fd5f12013-12-14 11:47:35 +080013OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
14OUTPUT_ARCH(aarch64)
15ENTRY(_start)
16SECTIONS
17{
macro.wave.z@gmail.com01bd3342016-12-08 11:58:22 +080018#ifdef CONFIG_ARMV8_SECURE_BASE
19 /DISCARD/ : { *(.rela._secure*) }
20#endif
David Feng85fd5f12013-12-14 11:47:35 +080021 . = 0x00000000;
22
23 . = ALIGN(8);
24 .text :
25 {
26 *(.__image_copy_start)
27 CPUDIR/start.o (.text*)
Alexander Graf94a10f22018-06-12 07:48:37 +020028 }
29
30 /* This needs to come before *(.text*) */
31 .efi_runtime : {
32 __efi_runtime_start = .;
33 *(.text.efi_runtime*)
34 *(.rodata.efi_runtime*)
35 *(.data.efi_runtime*)
36 __efi_runtime_stop = .;
37 }
38
39 .text_rest :
40 {
David Feng85fd5f12013-12-14 11:47:35 +080041 *(.text*)
42 }
macro.wave.z@gmail.com01bd3342016-12-08 11:58:22 +080043
44#ifdef CONFIG_ARMV8_PSCI
45 .__secure_start :
46#ifndef CONFIG_ARMV8_SECURE_BASE
47 ALIGN(CONSTANT(COMMONPAGESIZE))
48#endif
49 {
50 KEEP(*(.__secure_start))
51 }
52
53#ifndef CONFIG_ARMV8_SECURE_BASE
Tom Rinia17db832023-01-10 11:19:31 -050054#define __ARMV8_SECURE_BASE
macro.wave.z@gmail.com01bd3342016-12-08 11:58:22 +080055#define __ARMV8_PSCI_STACK_IN_RAM
Tom Rinia17db832023-01-10 11:19:31 -050056#else
57#define __ARMV8_SECURE_BASE CONFIG_ARMV8_SECURE_BASE
macro.wave.z@gmail.com01bd3342016-12-08 11:58:22 +080058#endif
Tom Rinia17db832023-01-10 11:19:31 -050059 .secure_text __ARMV8_SECURE_BASE :
macro.wave.z@gmail.com01bd3342016-12-08 11:58:22 +080060 AT(ADDR(.__secure_start) + SIZEOF(.__secure_start))
61 {
62 *(._secure.text)
Chee Hong Angfb140832019-02-12 00:27:02 -080063 . = ALIGN(8);
64 __secure_svc_tbl_start = .;
65 KEEP(*(._secure_svc_tbl_entries))
66 __secure_svc_tbl_end = .;
macro.wave.z@gmail.com01bd3342016-12-08 11:58:22 +080067 }
68
69 .secure_data : AT(LOADADDR(.secure_text) + SIZEOF(.secure_text))
70 {
71 *(._secure.data)
72 }
73
74 .secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data),
75 CONSTANT(COMMONPAGESIZE)) (NOLOAD) :
76#ifdef __ARMV8_PSCI_STACK_IN_RAM
77 AT(ADDR(.secure_stack))
78#else
79 AT(LOADADDR(.secure_data) + SIZEOF(.secure_data))
80#endif
81 {
82 KEEP(*(.__secure_stack_start))
83
84 . = . + CONFIG_ARMV8_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE;
85
86 . = ALIGN(CONSTANT(COMMONPAGESIZE));
87
88 KEEP(*(.__secure_stack_end))
89 }
90
91#ifndef __ARMV8_PSCI_STACK_IN_RAM
92 . = LOADADDR(.secure_stack);
93#endif
94
95 .__secure_end : AT(ADDR(.__secure_end)) {
96 KEEP(*(.__secure_end))
97 LONG(0x1d1071c); /* Must output something to reset LMA */
98 }
99#endif
David Feng85fd5f12013-12-14 11:47:35 +0800100
101 . = ALIGN(8);
102 .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
103
104 . = ALIGN(8);
105 .data : {
106 *(.data*)
107 }
108
109 . = ALIGN(8);
110
111 . = .;
112
113 . = ALIGN(8);
Andrew Scull5a9095c2022-05-30 10:00:04 +0000114 __u_boot_list : {
115 KEEP(*(SORT(__u_boot_list*)));
David Feng85fd5f12013-12-14 11:47:35 +0800116 }
117
118 . = ALIGN(8);
119
Alexander Graf0bd425a2016-03-04 01:10:01 +0100120 .efi_runtime_rel : {
121 __efi_runtime_rel_start = .;
Alexander Graf94a10f22018-06-12 07:48:37 +0200122 *(.rel*.efi_runtime)
123 *(.rel*.efi_runtime.*)
Alexander Graf0bd425a2016-03-04 01:10:01 +0100124 __efi_runtime_rel_stop = .;
125 }
126
127 . = ALIGN(8);
128
David Feng85fd5f12013-12-14 11:47:35 +0800129 .image_copy_end :
130 {
131 *(.__image_copy_end)
132 }
133
134 . = ALIGN(8);
135
136 .rel_dyn_start :
137 {
138 *(.__rel_dyn_start)
139 }
140
141 .rela.dyn : {
142 *(.rela*)
143 }
144
145 .rel_dyn_end :
146 {
147 *(.__rel_dyn_end)
148 }
149
150 _end = .;
151
152 . = ALIGN(8);
153
154 .bss_start : {
155 KEEP(*(.__bss_start));
156 }
157
158 .bss : {
159 *(.bss*)
160 . = ALIGN(8);
161 }
162
163 .bss_end : {
164 KEEP(*(.__bss_end));
165 }
166
167 /DISCARD/ : { *(.dynsym) }
168 /DISCARD/ : { *(.dynstr*) }
169 /DISCARD/ : { *(.dynamic*) }
170 /DISCARD/ : { *(.plt*) }
171 /DISCARD/ : { *(.interp*) }
172 /DISCARD/ : { *(.gnu*) }
Stephen Warren80a93652018-01-03 14:31:51 -0700173
174#ifdef CONFIG_LINUX_KERNEL_IMAGE_HEADER
175#include "linux-kernel-image-header-vars.h"
176#endif
David Feng85fd5f12013-12-14 11:47:35 +0800177}