7b76e0f9f08e26b30584b42f5336099e7e1f5197
[platform/kernel/u-boot.git] / arch / arm / cpu / armv8 / u-boot.lds
1 /*
2  * (C) Copyright 2013
3  * David Feng <fenghua@phytium.com.cn>
4  *
5  * (C) Copyright 2002
6  * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
7  *
8  * SPDX-License-Identifier:     GPL-2.0+
9  */
10
11 #include <config.h>
12 #include <asm/psci.h>
13
14 OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
15 OUTPUT_ARCH(aarch64)
16 ENTRY(_start)
17 SECTIONS
18 {
19 #ifdef CONFIG_ARMV8_SECURE_BASE
20         /DISCARD/ : { *(.rela._secure*) }
21 #endif
22         . = 0x00000000;
23
24         . = ALIGN(8);
25         .text :
26         {
27                 *(.__image_copy_start)
28                 CPUDIR/start.o (.text*)
29                 *(.text*)
30         }
31
32 #ifdef CONFIG_ARMV8_PSCI
33         .__secure_start :
34 #ifndef CONFIG_ARMV8_SECURE_BASE
35                 ALIGN(CONSTANT(COMMONPAGESIZE))
36 #endif
37         {
38                 KEEP(*(.__secure_start))
39         }
40
41 #ifndef CONFIG_ARMV8_SECURE_BASE
42 #define CONFIG_ARMV8_SECURE_BASE
43 #define __ARMV8_PSCI_STACK_IN_RAM
44 #endif
45         .secure_text CONFIG_ARMV8_SECURE_BASE :
46                 AT(ADDR(.__secure_start) + SIZEOF(.__secure_start))
47         {
48                 *(._secure.text)
49         }
50
51         .secure_data : AT(LOADADDR(.secure_text) + SIZEOF(.secure_text))
52         {
53                 *(._secure.data)
54         }
55
56         .secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data),
57                             CONSTANT(COMMONPAGESIZE)) (NOLOAD) :
58 #ifdef __ARMV8_PSCI_STACK_IN_RAM
59                 AT(ADDR(.secure_stack))
60 #else
61                 AT(LOADADDR(.secure_data) + SIZEOF(.secure_data))
62 #endif
63         {
64                 KEEP(*(.__secure_stack_start))
65
66                 . = . + CONFIG_ARMV8_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE;
67
68                 . = ALIGN(CONSTANT(COMMONPAGESIZE));
69
70                 KEEP(*(.__secure_stack_end))
71         }
72
73 #ifndef __ARMV8_PSCI_STACK_IN_RAM
74         . = LOADADDR(.secure_stack);
75 #endif
76
77         .__secure_end : AT(ADDR(.__secure_end)) {
78                 KEEP(*(.__secure_end))
79                 LONG(0x1d1071c);        /* Must output something to reset LMA */
80         }
81 #endif
82
83         . = ALIGN(8);
84         .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
85
86         . = ALIGN(8);
87         .data : {
88                 *(.data*)
89         }
90
91         . = ALIGN(8);
92
93         . = .;
94
95         . = ALIGN(8);
96         .u_boot_list : {
97                 KEEP(*(SORT(.u_boot_list*)));
98         }
99
100         . = ALIGN(8);
101
102         .efi_runtime : {
103                 __efi_runtime_start = .;
104                 *(efi_runtime_text)
105                 *(efi_runtime_data)
106                 __efi_runtime_stop = .;
107         }
108
109         .efi_runtime_rel : {
110                 __efi_runtime_rel_start = .;
111                 *(.relaefi_runtime_text)
112                 *(.relaefi_runtime_data)
113                 __efi_runtime_rel_stop = .;
114         }
115
116         . = ALIGN(8);
117
118         .image_copy_end :
119         {
120                 *(.__image_copy_end)
121         }
122
123         . = ALIGN(8);
124
125         .rel_dyn_start :
126         {
127                 *(.__rel_dyn_start)
128         }
129
130         .rela.dyn : {
131                 *(.rela*)
132         }
133
134         .rel_dyn_end :
135         {
136                 *(.__rel_dyn_end)
137         }
138
139         _end = .;
140
141         . = ALIGN(8);
142
143         .bss_start : {
144                 KEEP(*(.__bss_start));
145         }
146
147         .bss : {
148                 *(.bss*)
149                  . = ALIGN(8);
150         }
151
152         .bss_end : {
153                 KEEP(*(.__bss_end));
154         }
155
156         /DISCARD/ : { *(.dynsym) }
157         /DISCARD/ : { *(.dynstr*) }
158         /DISCARD/ : { *(.dynamic*) }
159         /DISCARD/ : { *(.plt*) }
160         /DISCARD/ : { *(.interp*) }
161         /DISCARD/ : { *(.gnu*) }
162
163 #ifdef CONFIG_LINUX_KERNEL_IMAGE_HEADER
164 #include "linux-kernel-image-header-vars.h"
165 #endif
166 }