Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 1 | /* |
Chris Kay | 33bfc5e | 2023-02-14 11:30:04 +0000 | [diff] [blame] | 2 | * Copyright (c) 2016-2023, Arm Limited and Contributors. All rights reserved. |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 5 | */ |
6 | |||||
Masahiro Yamada | 0b67e56 | 2020-03-09 17:39:48 +0900 | [diff] [blame] | 7 | #include <common/bl_common.ld.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | #include <lib/xlat_tables/xlat_tables_defs.h> |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 9 | |
10 | OUTPUT_FORMAT(elf32-littlearm) | ||||
11 | OUTPUT_ARCH(arm) | ||||
12 | ENTRY(sp_min_vector_table) | ||||
13 | |||||
14 | MEMORY { | ||||
15 | RAM (rwx): ORIGIN = BL32_BASE, LENGTH = BL32_LIMIT - BL32_BASE | ||||
16 | } | ||||
17 | |||||
Heiko Stuebner | 95ba355 | 2019-04-11 15:26:07 +0200 | [diff] [blame] | 18 | #ifdef PLAT_SP_MIN_EXTRA_LD_SCRIPT |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 19 | # include <plat_sp_min.ld.S> |
20 | #endif /* PLAT_SP_MIN_EXTRA_LD_SCRIPT */ | ||||
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 21 | |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 22 | SECTIONS { |
Harrison Mutai | c9f96d1 | 2023-04-19 09:30:15 +0100 | [diff] [blame] | 23 | RAM_REGION_START = ORIGIN(RAM); |
24 | RAM_REGION_LENGTH = LENGTH(RAM); | ||||
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 25 | . = BL32_BASE; |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 26 | |
Yann Gautier | 876be65 | 2020-10-05 09:54:09 +0200 | [diff] [blame] | 27 | ASSERT(. == ALIGN(PAGE_SIZE), |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 28 | "BL32_BASE address is not aligned on a page boundary.") |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 29 | |
30 | #if SEPARATE_CODE_AND_RODATA | ||||
31 | .text . : { | ||||
Andrey Skvortsov | 08526ad | 2023-09-05 22:09:25 +0300 | [diff] [blame] | 32 | ASSERT(. == ALIGN(PAGE_SIZE), |
33 | ".text address is not aligned on a page boundary."); | ||||
34 | |||||
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 35 | __TEXT_START__ = .; |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 36 | |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 37 | *entrypoint.o(.text*) |
Yann Gautier | 876be65 | 2020-10-05 09:54:09 +0200 | [diff] [blame] | 38 | *(SORT_BY_ALIGNMENT(.text*)) |
Yatharth Kochar | 06460cd | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 39 | *(.vectors) |
Michal Simek | 80c530e | 2023-04-27 14:26:03 +0200 | [diff] [blame] | 40 | __TEXT_END_UNALIGNED__ = .; |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 41 | |
Roberto Vargas | d93fde3 | 2018-04-11 11:53:31 +0100 | [diff] [blame] | 42 | . = ALIGN(PAGE_SIZE); |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 43 | |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 44 | __TEXT_END__ = .; |
45 | } >RAM | ||||
46 | |||||
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 47 | /* .ARM.extab and .ARM.exidx are only added because Clang needs them */ |
48 | .ARM.extab . : { | ||||
Roberto Vargas | 1d04c63 | 2018-05-10 11:01:16 +0100 | [diff] [blame] | 49 | *(.ARM.extab* .gnu.linkonce.armextab.*) |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 50 | } >RAM |
Roberto Vargas | 1d04c63 | 2018-05-10 11:01:16 +0100 | [diff] [blame] | 51 | |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 52 | .ARM.exidx . : { |
Roberto Vargas | 1d04c63 | 2018-05-10 11:01:16 +0100 | [diff] [blame] | 53 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 54 | } >RAM |
Roberto Vargas | 1d04c63 | 2018-05-10 11:01:16 +0100 | [diff] [blame] | 55 | |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 56 | .rodata . : { |
57 | __RODATA_START__ = .; | ||||
Yann Gautier | 876be65 | 2020-10-05 09:54:09 +0200 | [diff] [blame] | 58 | *(SORT_BY_ALIGNMENT(.rodata*)) |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 59 | |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 60 | RODATA_COMMON |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 61 | |
Jeenu Viswambharan | e3f2200 | 2017-09-22 08:32:10 +0100 | [diff] [blame] | 62 | . = ALIGN(8); |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 63 | |
64 | # include <lib/el3_runtime/pubsub_events.h> | ||||
Michal Simek | 80c530e | 2023-04-27 14:26:03 +0200 | [diff] [blame] | 65 | __RODATA_END_UNALIGNED__ = .; |
Jeenu Viswambharan | e3f2200 | 2017-09-22 08:32:10 +0100 | [diff] [blame] | 66 | |
Roberto Vargas | d93fde3 | 2018-04-11 11:53:31 +0100 | [diff] [blame] | 67 | . = ALIGN(PAGE_SIZE); |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 68 | |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 69 | __RODATA_END__ = .; |
70 | } >RAM | ||||
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 71 | #else /* SEPARATE_CODE_AND_RODATA */ |
Chris Kay | 33bfc5e | 2023-02-14 11:30:04 +0000 | [diff] [blame] | 72 | .ro . : { |
Andrey Skvortsov | 08526ad | 2023-09-05 22:09:25 +0300 | [diff] [blame] | 73 | ASSERT(. == ALIGN(PAGE_SIZE), |
74 | ".ro address is not aligned on a page boundary."); | ||||
75 | |||||
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 76 | __RO_START__ = .; |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 77 | |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 78 | *entrypoint.o(.text*) |
Yann Gautier | 876be65 | 2020-10-05 09:54:09 +0200 | [diff] [blame] | 79 | *(SORT_BY_ALIGNMENT(.text*)) |
80 | *(SORT_BY_ALIGNMENT(.rodata*)) | ||||
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 81 | |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 82 | RODATA_COMMON |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 83 | |
Jeenu Viswambharan | e3f2200 | 2017-09-22 08:32:10 +0100 | [diff] [blame] | 84 | . = ALIGN(8); |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 85 | |
86 | # include <lib/el3_runtime/pubsub_events.h> | ||||
Jeenu Viswambharan | e3f2200 | 2017-09-22 08:32:10 +0100 | [diff] [blame] | 87 | |
Yatharth Kochar | 06460cd | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 88 | *(.vectors) |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 89 | |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 90 | __RO_END_UNALIGNED__ = .; |
91 | |||||
92 | /* | ||||
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 93 | * Memory page(s) mapped to this section will be marked as device |
94 | * memory. No other unexpected data must creep in. Ensure that the rest | ||||
95 | * of the current memory page is unused. | ||||
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 96 | */ |
Roberto Vargas | d93fde3 | 2018-04-11 11:53:31 +0100 | [diff] [blame] | 97 | . = ALIGN(PAGE_SIZE); |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 98 | |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 99 | __RO_END__ = .; |
100 | } >RAM | ||||
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 101 | #endif /* SEPARATE_CODE_AND_RODATA */ |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 102 | |
103 | ASSERT(__CPU_OPS_END__ > __CPU_OPS_START__, | ||||
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 104 | "cpu_ops not defined for this platform.") |
105 | |||||
106 | __RW_START__ = .; | ||||
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 107 | |
Masahiro Yamada | c5864d8 | 2020-04-22 10:50:12 +0900 | [diff] [blame] | 108 | DATA_SECTION >RAM |
Yann Gautier | 514e59c | 2020-10-05 11:02:54 +0200 | [diff] [blame] | 109 | RELA_SECTION >RAM |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 110 | |
Soby Mathew | bf16923 | 2017-11-14 14:10:10 +0000 | [diff] [blame] | 111 | #ifdef BL32_PROGBITS_LIMIT |
112 | ASSERT(. <= BL32_PROGBITS_LIMIT, "BL32 progbits has exceeded its limit.") | ||||
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 113 | #endif /* BL32_PROGBITS_LIMIT */ |
Soby Mathew | bf16923 | 2017-11-14 14:10:10 +0000 | [diff] [blame] | 114 | |
Masahiro Yamada | 403990e | 2020-04-07 13:04:24 +0900 | [diff] [blame] | 115 | STACK_SECTION >RAM |
Masahiro Yamada | dd053b6 | 2020-03-26 13:16:33 +0900 | [diff] [blame] | 116 | BSS_SECTION >RAM |
Masahiro Yamada | 0b67e56 | 2020-03-09 17:39:48 +0900 | [diff] [blame] | 117 | XLAT_TABLE_SECTION >RAM |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 118 | |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 119 | __BSS_SIZE__ = SIZEOF(.bss); |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 120 | |
121 | #if USE_COHERENT_MEM | ||||
122 | /* | ||||
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 123 | * The base address of the coherent memory section must be page-aligned to |
124 | * guarantee that the coherent data are stored on their own pages and are | ||||
125 | * not mixed with normal data. This is required to set up the correct | ||||
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 126 | * memory attributes for the coherent data page tables. |
127 | */ | ||||
Chris Kay | 33bfc5e | 2023-02-14 11:30:04 +0000 | [diff] [blame] | 128 | .coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) { |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 129 | __COHERENT_RAM_START__ = .; |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 130 | |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 131 | /* |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 132 | * Bakery locks are stored in coherent memory. Each lock's data is |
133 | * contiguous and fully allocated by the compiler. | ||||
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 134 | */ |
Chris Kay | 33bfc5e | 2023-02-14 11:30:04 +0000 | [diff] [blame] | 135 | *(.bakery_lock) |
136 | *(.tzfw_coherent_mem) | ||||
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 137 | |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 138 | __COHERENT_RAM_END_UNALIGNED__ = .; |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 139 | |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 140 | /* |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 141 | * Memory page(s) mapped to this section will be marked as device |
142 | * memory. No other unexpected data must creep in. Ensure that the rest | ||||
143 | * of the current memory page is unused. | ||||
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 144 | */ |
Roberto Vargas | d93fde3 | 2018-04-11 11:53:31 +0100 | [diff] [blame] | 145 | . = ALIGN(PAGE_SIZE); |
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 146 | |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 147 | __COHERENT_RAM_END__ = .; |
148 | } >RAM | ||||
149 | |||||
150 | __COHERENT_RAM_UNALIGNED_SIZE__ = | ||||
151 | __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__; | ||||
Chris Kay | 4b7660a | 2022-09-29 14:36:53 +0100 | [diff] [blame] | 152 | #endif /* USE_COHERENT_MEM */ |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 153 | |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 154 | __RW_END__ = .; |
Yann Gautier | 876be65 | 2020-10-05 09:54:09 +0200 | [diff] [blame] | 155 | __BL32_END__ = .; |
Yann Gautier | 1b4d6ae | 2020-10-05 11:39:19 +0200 | [diff] [blame] | 156 | |
Yann Gautier | 514e59c | 2020-10-05 11:02:54 +0200 | [diff] [blame] | 157 | /DISCARD/ : { |
158 | *(.dynsym .dynstr .hash .gnu.hash) | ||||
159 | } | ||||
160 | |||||
Yann Gautier | 1b4d6ae | 2020-10-05 11:39:19 +0200 | [diff] [blame] | 161 | ASSERT(. <= BL32_LIMIT, "BL32 image has exceeded its limit.") |
Harrison Mutai | c9f96d1 | 2023-04-19 09:30:15 +0100 | [diff] [blame] | 162 | RAM_REGION_END = .; |
Soby Mathew | ec8ac1c | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 163 | } |