Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
David Feng | 0ae7653 | 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 | 0ae7653 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 8 | */ |
| 9 | |
macro.wave.z@gmail.com | df88cb3 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 10 | #include <config.h> |
| 11 | #include <asm/psci.h> |
| 12 | |
David Feng | 0ae7653 | 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 | df88cb3 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 18 | #ifdef CONFIG_ARMV8_SECURE_BASE |
| 19 | /DISCARD/ : { *(.rela._secure*) } |
| 20 | #endif |
David Feng | 0ae7653 | 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 | 7e21fbc | 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 | 0ae7653 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 41 | *(.text*) |
| 42 | } |
| 43 | |
macro.wave.z@gmail.com | df88cb3 | 2016-12-08 11:58:22 +0800 | [diff] [blame] | 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) |
| 61 | } |
| 62 | |
| 63 | .secure_data : AT(LOADADDR(.secure_text) + SIZEOF(.secure_text)) |
| 64 | { |
| 65 | *(._secure.data) |
| 66 | } |
| 67 | |
| 68 | .secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data), |
| 69 | CONSTANT(COMMONPAGESIZE)) (NOLOAD) : |
| 70 | #ifdef __ARMV8_PSCI_STACK_IN_RAM |
| 71 | AT(ADDR(.secure_stack)) |
| 72 | #else |
| 73 | AT(LOADADDR(.secure_data) + SIZEOF(.secure_data)) |
| 74 | #endif |
| 75 | { |
| 76 | KEEP(*(.__secure_stack_start)) |
| 77 | |
| 78 | . = . + CONFIG_ARMV8_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE; |
| 79 | |
| 80 | . = ALIGN(CONSTANT(COMMONPAGESIZE)); |
| 81 | |
| 82 | KEEP(*(.__secure_stack_end)) |
| 83 | } |
| 84 | |
| 85 | #ifndef __ARMV8_PSCI_STACK_IN_RAM |
| 86 | . = LOADADDR(.secure_stack); |
| 87 | #endif |
| 88 | |
| 89 | .__secure_end : AT(ADDR(.__secure_end)) { |
| 90 | KEEP(*(.__secure_end)) |
| 91 | LONG(0x1d1071c); /* Must output something to reset LMA */ |
| 92 | } |
| 93 | #endif |
| 94 | |
David Feng | 0ae7653 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 95 | . = ALIGN(8); |
| 96 | .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } |
| 97 | |
| 98 | . = ALIGN(8); |
| 99 | .data : { |
| 100 | *(.data*) |
| 101 | } |
| 102 | |
| 103 | . = ALIGN(8); |
| 104 | |
| 105 | . = .; |
| 106 | |
| 107 | . = ALIGN(8); |
| 108 | .u_boot_list : { |
| 109 | KEEP(*(SORT(.u_boot_list*))); |
| 110 | } |
| 111 | |
| 112 | . = ALIGN(8); |
| 113 | |
Alexander Graf | 50149ea | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 114 | .efi_runtime_rel : { |
| 115 | __efi_runtime_rel_start = .; |
Alexander Graf | 7e21fbc | 2018-06-12 07:48:37 +0200 | [diff] [blame] | 116 | *(.rel*.efi_runtime) |
| 117 | *(.rel*.efi_runtime.*) |
Alexander Graf | 50149ea | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 118 | __efi_runtime_rel_stop = .; |
| 119 | } |
| 120 | |
| 121 | . = ALIGN(8); |
| 122 | |
David Feng | 0ae7653 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 123 | .image_copy_end : |
| 124 | { |
| 125 | *(.__image_copy_end) |
| 126 | } |
| 127 | |
| 128 | . = ALIGN(8); |
| 129 | |
| 130 | .rel_dyn_start : |
| 131 | { |
| 132 | *(.__rel_dyn_start) |
| 133 | } |
| 134 | |
| 135 | .rela.dyn : { |
| 136 | *(.rela*) |
| 137 | } |
| 138 | |
| 139 | .rel_dyn_end : |
| 140 | { |
| 141 | *(.__rel_dyn_end) |
| 142 | } |
| 143 | |
| 144 | _end = .; |
| 145 | |
| 146 | . = ALIGN(8); |
| 147 | |
| 148 | .bss_start : { |
| 149 | KEEP(*(.__bss_start)); |
| 150 | } |
| 151 | |
| 152 | .bss : { |
| 153 | *(.bss*) |
| 154 | . = ALIGN(8); |
| 155 | } |
| 156 | |
| 157 | .bss_end : { |
| 158 | KEEP(*(.__bss_end)); |
| 159 | } |
| 160 | |
| 161 | /DISCARD/ : { *(.dynsym) } |
| 162 | /DISCARD/ : { *(.dynstr*) } |
| 163 | /DISCARD/ : { *(.dynamic*) } |
| 164 | /DISCARD/ : { *(.plt*) } |
| 165 | /DISCARD/ : { *(.interp*) } |
| 166 | /DISCARD/ : { *(.gnu*) } |
Stephen Warren | 8163faf | 2018-01-03 14:31:51 -0700 | [diff] [blame] | 167 | |
| 168 | #ifdef CONFIG_LINUX_KERNEL_IMAGE_HEADER |
| 169 | #include "linux-kernel-image-header-vars.h" |
| 170 | #endif |
David Feng | 0ae7653 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 171 | } |