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