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); |
Ilias Apalodimas | cdb5839 | 2024-03-15 08:43:50 +0200 | [diff] [blame] | 24 | __image_copy_start = ADDR(.text); |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 25 | .text : |
| 26 | { |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 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 | |
Ilias Apalodimas | 3f9a311 | 2025-02-20 15:54:40 +0200 | [diff] [blame^] | 39 | #ifdef CONFIG_MMU_PGPROT |
| 40 | .text_rest ALIGN(CONSTANT(COMMONPAGESIZE)) : |
| 41 | #else |
Alexander Graf | 94a10f2 | 2018-06-12 07:48:37 +0200 | [diff] [blame] | 42 | .text_rest : |
Ilias Apalodimas | 3f9a311 | 2025-02-20 15:54:40 +0200 | [diff] [blame^] | 43 | #endif |
Alexander Graf | 94a10f2 | 2018-06-12 07:48:37 +0200 | [diff] [blame] | 44 | { |
Ilias Apalodimas | 3f9a311 | 2025-02-20 15:54:40 +0200 | [diff] [blame^] | 45 | __text_start = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 46 | *(.text*) |
Ilias Apalodimas | 3f9a311 | 2025-02-20 15:54:40 +0200 | [diff] [blame^] | 47 | #ifdef CONFIG_MMU_PGPROT |
| 48 | . = ALIGN(CONSTANT(COMMONPAGESIZE)); |
| 49 | #endif |
| 50 | __text_end = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 51 | } |
macro.wave.z@gmail.com | 01bd334 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 52 | |
| 53 | #ifdef CONFIG_ARMV8_PSCI |
| 54 | .__secure_start : |
| 55 | #ifndef CONFIG_ARMV8_SECURE_BASE |
| 56 | ALIGN(CONSTANT(COMMONPAGESIZE)) |
| 57 | #endif |
| 58 | { |
| 59 | KEEP(*(.__secure_start)) |
| 60 | } |
| 61 | |
| 62 | #ifndef CONFIG_ARMV8_SECURE_BASE |
Tom Rini | a17db83 | 2023-01-10 11:19:31 -0500 | [diff] [blame] | 63 | #define __ARMV8_SECURE_BASE |
macro.wave.z@gmail.com | 01bd334 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 64 | #define __ARMV8_PSCI_STACK_IN_RAM |
Tom Rini | a17db83 | 2023-01-10 11:19:31 -0500 | [diff] [blame] | 65 | #else |
| 66 | #define __ARMV8_SECURE_BASE CONFIG_ARMV8_SECURE_BASE |
macro.wave.z@gmail.com | 01bd334 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 67 | #endif |
Tom Rini | a17db83 | 2023-01-10 11:19:31 -0500 | [diff] [blame] | 68 | .secure_text __ARMV8_SECURE_BASE : |
macro.wave.z@gmail.com | 01bd334 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 69 | AT(ADDR(.__secure_start) + SIZEOF(.__secure_start)) |
| 70 | { |
| 71 | *(._secure.text) |
Chee Hong Ang | fb14083 | 2019-02-12 00:27:02 -0800 | [diff] [blame] | 72 | . = ALIGN(8); |
| 73 | __secure_svc_tbl_start = .; |
| 74 | KEEP(*(._secure_svc_tbl_entries)) |
| 75 | __secure_svc_tbl_end = .; |
macro.wave.z@gmail.com | 01bd334 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | .secure_data : AT(LOADADDR(.secure_text) + SIZEOF(.secure_text)) |
| 79 | { |
| 80 | *(._secure.data) |
| 81 | } |
| 82 | |
| 83 | .secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data), |
| 84 | CONSTANT(COMMONPAGESIZE)) (NOLOAD) : |
| 85 | #ifdef __ARMV8_PSCI_STACK_IN_RAM |
| 86 | AT(ADDR(.secure_stack)) |
| 87 | #else |
| 88 | AT(LOADADDR(.secure_data) + SIZEOF(.secure_data)) |
| 89 | #endif |
| 90 | { |
| 91 | KEEP(*(.__secure_stack_start)) |
| 92 | |
| 93 | . = . + CONFIG_ARMV8_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE; |
| 94 | |
| 95 | . = ALIGN(CONSTANT(COMMONPAGESIZE)); |
| 96 | |
| 97 | KEEP(*(.__secure_stack_end)) |
| 98 | } |
| 99 | |
| 100 | #ifndef __ARMV8_PSCI_STACK_IN_RAM |
| 101 | . = LOADADDR(.secure_stack); |
| 102 | #endif |
| 103 | |
| 104 | .__secure_end : AT(ADDR(.__secure_end)) { |
| 105 | KEEP(*(.__secure_end)) |
| 106 | LONG(0x1d1071c); /* Must output something to reset LMA */ |
| 107 | } |
| 108 | #endif |
Ilias Apalodimas | 3f9a311 | 2025-02-20 15:54:40 +0200 | [diff] [blame^] | 109 | .efi_runtime_rel : { |
| 110 | __efi_runtime_rel_start = .; |
| 111 | *(.rel*.efi_runtime) |
| 112 | *(.rel*.efi_runtime.*) |
| 113 | __efi_runtime_rel_stop = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 114 | } |
| 115 | |
Ilias Apalodimas | 3f9a311 | 2025-02-20 15:54:40 +0200 | [diff] [blame^] | 116 | #ifdef CONFIG_MMU_PGPROT |
| 117 | .rodata ALIGN(CONSTANT(COMMONPAGESIZE)): { |
| 118 | #else |
| 119 | .rodata ALIGN(8) : { |
| 120 | #endif |
| 121 | __start_rodata = .; |
| 122 | *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) |
| 123 | } |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 124 | |
Ilias Apalodimas | 3f9a311 | 2025-02-20 15:54:40 +0200 | [diff] [blame^] | 125 | __u_boot_list ALIGN(8) : { |
Andrew Scull | 5a9095c | 2022-05-30 10:00:04 +0000 | [diff] [blame] | 126 | KEEP(*(SORT(__u_boot_list*))); |
Ilias Apalodimas | 3f9a311 | 2025-02-20 15:54:40 +0200 | [diff] [blame^] | 127 | #ifdef CONFIG_MMU_PGPROT |
| 128 | . = ALIGN(CONSTANT(COMMONPAGESIZE)); |
| 129 | #endif |
| 130 | __end_rodata = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 131 | } |
| 132 | |
Ilias Apalodimas | 3f9a311 | 2025-02-20 15:54:40 +0200 | [diff] [blame^] | 133 | #ifdef CONFIG_MMU_PGPROT |
| 134 | .data ALIGN(CONSTANT(COMMONPAGESIZE)) : { |
| 135 | #else |
| 136 | .data ALIGN(8) : { |
| 137 | #endif |
| 138 | __start_data = .; |
| 139 | *(.data*) |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | . = ALIGN(8); |
Ilias Apalodimas | cdb5839 | 2024-03-15 08:43:50 +0200 | [diff] [blame] | 143 | __image_copy_end = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 144 | |
Ilias Apalodimas | 3f9a311 | 2025-02-20 15:54:40 +0200 | [diff] [blame^] | 145 | .rela.dyn ALIGN(8) : { |
Ilias Apalodimas | 45b1bd9 | 2024-03-15 08:43:48 +0200 | [diff] [blame] | 146 | __rel_dyn_start = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 147 | *(.rela*) |
Ilias Apalodimas | 45b1bd9 | 2024-03-15 08:43:48 +0200 | [diff] [blame] | 148 | __rel_dyn_end = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | _end = .; |
| 152 | |
Ilias Apalodimas | 772acf8 | 2024-03-15 08:43:51 +0200 | [diff] [blame] | 153 | /* |
| 154 | * arch/arm/lib/crt0_64.S assumes __bss_start - __bss_end % 8 == 0 |
| 155 | */ |
Ilias Apalodimas | 3f9a311 | 2025-02-20 15:54:40 +0200 | [diff] [blame^] | 156 | .bss ADDR(.rela.dyn) (OVERLAY) : { |
Ilias Apalodimas | 6d1e1b8 | 2024-03-15 08:43:46 +0200 | [diff] [blame] | 157 | __bss_start = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 158 | *(.bss*) |
Ilias Apalodimas | 6d1e1b8 | 2024-03-15 08:43:46 +0200 | [diff] [blame] | 159 | . = ALIGN(8); |
| 160 | __bss_end = .; |
Ilias Apalodimas | 3f9a311 | 2025-02-20 15:54:40 +0200 | [diff] [blame^] | 161 | #ifdef CONFIG_MMU_PGPROT |
| 162 | . = ALIGN(CONSTANT(COMMONPAGESIZE)); |
| 163 | #endif |
| 164 | __end_data = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 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 | } |