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 | |
| 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 | |
Ilias Apalodimas | 9b37894 | 2024-03-15 08:43:47 +0200 | [diff] [blame] | 118 | .efi_runtime_rel ALIGN(8) : { |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 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); |
Ilias Apalodimas | cdb5839 | 2024-03-15 08:43:50 +0200 | [diff] [blame^] | 126 | __image_copy_end = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 127 | |
Ilias Apalodimas | 45b1bd9 | 2024-03-15 08:43:48 +0200 | [diff] [blame] | 128 | .rela.dyn ALIGN(8) : { |
| 129 | __rel_dyn_start = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 130 | *(.rela*) |
Ilias Apalodimas | 45b1bd9 | 2024-03-15 08:43:48 +0200 | [diff] [blame] | 131 | __rel_dyn_end = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | _end = .; |
| 135 | |
Ilias Apalodimas | 6d1e1b8 | 2024-03-15 08:43:46 +0200 | [diff] [blame] | 136 | .bss ALIGN(8): { |
| 137 | __bss_start = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 138 | *(.bss*) |
Ilias Apalodimas | 6d1e1b8 | 2024-03-15 08:43:46 +0200 | [diff] [blame] | 139 | . = ALIGN(8); |
| 140 | __bss_end = .; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | /DISCARD/ : { *(.dynsym) } |
| 144 | /DISCARD/ : { *(.dynstr*) } |
| 145 | /DISCARD/ : { *(.dynamic*) } |
| 146 | /DISCARD/ : { *(.plt*) } |
| 147 | /DISCARD/ : { *(.interp*) } |
| 148 | /DISCARD/ : { *(.gnu*) } |
Stephen Warren | 80a9365 | 2018-01-03 14:31:51 -0700 | [diff] [blame] | 149 | |
| 150 | #ifdef CONFIG_LINUX_KERNEL_IMAGE_HEADER |
| 151 | #include "linux-kernel-image-header-vars.h" |
| 152 | #endif |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 153 | } |