blob: 5ba54dcedf2429dfabbbf11817da0e55e5c4dd07 [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
Ilias Apalodimas9b378942024-03-15 08:43:47 +0200118 .efi_runtime_rel ALIGN(8) : {
Alexander Graf0bd425a2016-03-04 01:10:01 +0100119 __efi_runtime_rel_start = .;
Alexander Graf94a10f22018-06-12 07:48:37 +0200120 *(.rel*.efi_runtime)
121 *(.rel*.efi_runtime.*)
Alexander Graf0bd425a2016-03-04 01:10:01 +0100122 __efi_runtime_rel_stop = .;
123 }
124
125 . = ALIGN(8);
126
David Feng85fd5f12013-12-14 11:47:35 +0800127 .image_copy_end :
128 {
129 *(.__image_copy_end)
130 }
131
Ilias Apalodimas45b1bd92024-03-15 08:43:48 +0200132 .rela.dyn ALIGN(8) : {
133 __rel_dyn_start = .;
David Feng85fd5f12013-12-14 11:47:35 +0800134 *(.rela*)
Ilias Apalodimas45b1bd92024-03-15 08:43:48 +0200135 __rel_dyn_end = .;
David Feng85fd5f12013-12-14 11:47:35 +0800136 }
137
138 _end = .;
139
Ilias Apalodimas6d1e1b82024-03-15 08:43:46 +0200140 .bss ALIGN(8): {
141 __bss_start = .;
David Feng85fd5f12013-12-14 11:47:35 +0800142 *(.bss*)
Ilias Apalodimas6d1e1b82024-03-15 08:43:46 +0200143 . = ALIGN(8);
144 __bss_end = .;
David Feng85fd5f12013-12-14 11:47:35 +0800145 }
146
147 /DISCARD/ : { *(.dynsym) }
148 /DISCARD/ : { *(.dynstr*) }
149 /DISCARD/ : { *(.dynamic*) }
150 /DISCARD/ : { *(.plt*) }
151 /DISCARD/ : { *(.interp*) }
152 /DISCARD/ : { *(.gnu*) }
Stephen Warren80a93652018-01-03 14:31:51 -0700153
154#ifdef CONFIG_LINUX_KERNEL_IMAGE_HEADER
155#include "linux-kernel-image-header-vars.h"
156#endif
David Feng85fd5f12013-12-14 11:47:35 +0800157}