Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 2 | /* |
| 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 Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 8 | */ |
| 9 | |
macro.wave.z@gmail.com | 01bd334 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 10 | #include <config.h> |
| 11 | #include <asm/psci.h> |
| 12 | |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 13 | OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") |
| 14 | OUTPUT_ARCH(aarch64) |
| 15 | ENTRY(_start) |
| 16 | SECTIONS |
| 17 | { |
macro.wave.z@gmail.com | 01bd334 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 18 | #ifdef CONFIG_ARMV8_SECURE_BASE |
| 19 | /DISCARD/ : { *(.rela._secure*) } |
| 20 | #endif |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 21 | . = 0x00000000; |
| 22 | |
| 23 | . = ALIGN(8); |
| 24 | .text : |
| 25 | { |
| 26 | *(.__image_copy_start) |
| 27 | CPUDIR/start.o (.text*) |
Alexander Graf | 94a10f2 | 2018-06-12 07:48:37 +0200 | [diff] [blame] | 28 | } |
| 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 Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 41 | *(.text*) |
| 42 | } |
macro.wave.z@gmail.com | 01bd334 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 43 | |
| 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 Rini | a17db83 | 2023-01-10 11:19:31 -0500 | [diff] [blame] | 54 | #define __ARMV8_SECURE_BASE |
macro.wave.z@gmail.com | 01bd334 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 55 | #define __ARMV8_PSCI_STACK_IN_RAM |
Tom Rini | a17db83 | 2023-01-10 11:19:31 -0500 | [diff] [blame] | 56 | #else |
| 57 | #define __ARMV8_SECURE_BASE CONFIG_ARMV8_SECURE_BASE |
macro.wave.z@gmail.com | 01bd334 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 58 | #endif |
Tom Rini | a17db83 | 2023-01-10 11:19:31 -0500 | [diff] [blame] | 59 | .secure_text __ARMV8_SECURE_BASE : |
macro.wave.z@gmail.com | 01bd334 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 60 | AT(ADDR(.__secure_start) + SIZEOF(.__secure_start)) |
| 61 | { |
| 62 | *(._secure.text) |
Chee Hong Ang | fb14083 | 2019-02-12 00:27:02 -0800 | [diff] [blame] | 63 | . = ALIGN(8); |
| 64 | __secure_svc_tbl_start = .; |
| 65 | KEEP(*(._secure_svc_tbl_entries)) |
| 66 | __secure_svc_tbl_end = .; |
macro.wave.z@gmail.com | 01bd334 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 67 | } |
| 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 Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 100 | |
| 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 Scull | 5a9095c | 2022-05-30 10:00:04 +0000 | [diff] [blame] | 114 | __u_boot_list : { |
| 115 | KEEP(*(SORT(__u_boot_list*))); |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | . = ALIGN(8); |
| 119 | |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 120 | .efi_runtime_rel : { |
| 121 | __efi_runtime_rel_start = .; |
Alexander Graf | 94a10f2 | 2018-06-12 07:48:37 +0200 | [diff] [blame] | 122 | *(.rel*.efi_runtime) |
| 123 | *(.rel*.efi_runtime.*) |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 124 | __efi_runtime_rel_stop = .; |
| 125 | } |
| 126 | |
| 127 | . = ALIGN(8); |
| 128 | |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 129 | .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 Warren | 80a9365 | 2018-01-03 14:31:51 -0700 | [diff] [blame] | 173 | |
| 174 | #ifdef CONFIG_LINUX_KERNEL_IMAGE_HEADER |
| 175 | #include "linux-kernel-image-header-vars.h" |
| 176 | #endif |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 177 | } |