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 |
| 54 | #define CONFIG_ARMV8_SECURE_BASE |
| 55 | #define __ARMV8_PSCI_STACK_IN_RAM |
| 56 | #endif |
| 57 | .secure_text CONFIG_ARMV8_SECURE_BASE : |
| 58 | AT(ADDR(.__secure_start) + SIZEOF(.__secure_start)) |
| 59 | { |
| 60 | *(._secure.text) |
Chee Hong Ang | fb14083 | 2019-02-12 00:27:02 -0800 | [diff] [blame] | 61 | . = ALIGN(8); |
| 62 | __secure_svc_tbl_start = .; |
| 63 | KEEP(*(._secure_svc_tbl_entries)) |
| 64 | __secure_svc_tbl_end = .; |
macro.wave.z@gmail.com | 01bd334 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | .secure_data : AT(LOADADDR(.secure_text) + SIZEOF(.secure_text)) |
| 68 | { |
| 69 | *(._secure.data) |
| 70 | } |
| 71 | |
| 72 | .secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data), |
| 73 | CONSTANT(COMMONPAGESIZE)) (NOLOAD) : |
| 74 | #ifdef __ARMV8_PSCI_STACK_IN_RAM |
| 75 | AT(ADDR(.secure_stack)) |
| 76 | #else |
| 77 | AT(LOADADDR(.secure_data) + SIZEOF(.secure_data)) |
| 78 | #endif |
| 79 | { |
| 80 | KEEP(*(.__secure_stack_start)) |
| 81 | |
| 82 | . = . + CONFIG_ARMV8_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE; |
| 83 | |
| 84 | . = ALIGN(CONSTANT(COMMONPAGESIZE)); |
| 85 | |
| 86 | KEEP(*(.__secure_stack_end)) |
| 87 | } |
| 88 | |
| 89 | #ifndef __ARMV8_PSCI_STACK_IN_RAM |
| 90 | . = LOADADDR(.secure_stack); |
| 91 | #endif |
| 92 | |
| 93 | .__secure_end : AT(ADDR(.__secure_end)) { |
| 94 | KEEP(*(.__secure_end)) |
| 95 | LONG(0x1d1071c); /* Must output something to reset LMA */ |
| 96 | } |
| 97 | #endif |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 98 | |
| 99 | . = ALIGN(8); |
| 100 | .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } |
| 101 | |
| 102 | . = ALIGN(8); |
| 103 | .data : { |
| 104 | *(.data*) |
| 105 | } |
| 106 | |
| 107 | . = ALIGN(8); |
| 108 | |
| 109 | . = .; |
| 110 | |
| 111 | . = ALIGN(8); |
Andrew Scull | 5a9095c | 2022-05-30 10:00:04 +0000 | [diff] [blame] | 112 | __u_boot_list : { |
| 113 | KEEP(*(SORT(__u_boot_list*))); |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | . = ALIGN(8); |
| 117 | |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 118 | .efi_runtime_rel : { |
| 119 | __efi_runtime_rel_start = .; |
Alexander Graf | 94a10f2 | 2018-06-12 07:48:37 +0200 | [diff] [blame] | 120 | *(.rel*.efi_runtime) |
| 121 | *(.rel*.efi_runtime.*) |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 122 | __efi_runtime_rel_stop = .; |
| 123 | } |
| 124 | |
| 125 | . = ALIGN(8); |
| 126 | |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 127 | .image_copy_end : |
| 128 | { |
| 129 | *(.__image_copy_end) |
| 130 | } |
| 131 | |
| 132 | . = ALIGN(8); |
| 133 | |
| 134 | .rel_dyn_start : |
| 135 | { |
| 136 | *(.__rel_dyn_start) |
| 137 | } |
| 138 | |
| 139 | .rela.dyn : { |
| 140 | *(.rela*) |
| 141 | } |
| 142 | |
| 143 | .rel_dyn_end : |
| 144 | { |
| 145 | *(.__rel_dyn_end) |
| 146 | } |
| 147 | |
| 148 | _end = .; |
| 149 | |
| 150 | . = ALIGN(8); |
| 151 | |
| 152 | .bss_start : { |
| 153 | KEEP(*(.__bss_start)); |
| 154 | } |
| 155 | |
| 156 | .bss : { |
| 157 | *(.bss*) |
| 158 | . = ALIGN(8); |
| 159 | } |
| 160 | |
| 161 | .bss_end : { |
| 162 | KEEP(*(.__bss_end)); |
| 163 | } |
| 164 | |
| 165 | /DISCARD/ : { *(.dynsym) } |
| 166 | /DISCARD/ : { *(.dynstr*) } |
| 167 | /DISCARD/ : { *(.dynamic*) } |
| 168 | /DISCARD/ : { *(.plt*) } |
| 169 | /DISCARD/ : { *(.interp*) } |
| 170 | /DISCARD/ : { *(.gnu*) } |
Stephen Warren | 80a9365 | 2018-01-03 14:31:51 -0700 | [diff] [blame] | 171 | |
| 172 | #ifdef CONFIG_LINUX_KERNEL_IMAGE_HEADER |
| 173 | #include "linux-kernel-image-header-vars.h" |
| 174 | #endif |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 175 | } |