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