xref: /optee_os/core/include/kernel/linker.h (revision 19a31ec40245ae01a9adcd206eec2a4bb4479fc9)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2017, Linaro Limited
4  */
5 #ifndef __KERNEL_LINKER_H
6 #define __KERNEL_LINKER_H
7 
8 #include <kernel/dt.h>
9 #include <types_ext.h>
10 
11 /*
12  * Symbols exported by the link script.
13  */
14 
15 #ifdef ARM32
16 
17 /*
18  * These addresses will be the start or end of the exception binary search
19  * index table (.ARM.exidx section)
20  */
21 extern const uint8_t __exidx_start[];
22 extern const uint8_t __exidx_end[];
23 extern const uint8_t __extab_start[];
24 extern const uint8_t __extab_end[];
25 
26 #endif
27 
28 #define VCORE_UNPG_RX_PA	((unsigned long)__vcore_unpg_rx_start)
29 #define VCORE_UNPG_RX_SZ	((size_t)(__vcore_unpg_rx_end - \
30 					  __vcore_unpg_rx_start))
31 #define VCORE_UNPG_RO_PA	((unsigned long)__vcore_unpg_ro_start)
32 #define VCORE_UNPG_RO_SZ	((size_t)(__vcore_unpg_ro_end - \
33 					  __vcore_unpg_ro_start))
34 #define VCORE_UNPG_RW_PA	((unsigned long)__vcore_unpg_rw_start)
35 #define VCORE_UNPG_RW_SZ	((size_t)(__vcore_unpg_rw_end - \
36 					  __vcore_unpg_rw_start))
37 #define VCORE_NEX_RW_PA	((unsigned long)__vcore_nex_rw_start)
38 #define VCORE_NEX_RW_SZ	((size_t)(__vcore_nex_rw_end - \
39 					 __vcore_nex_rw_start))
40 #define VCORE_INIT_RX_PA	((unsigned long)__vcore_init_rx_start)
41 #define VCORE_INIT_RX_SZ	((size_t)(__vcore_init_rx_end - \
42 					  __vcore_init_rx_start))
43 #define VCORE_INIT_RO_PA	((unsigned long)__vcore_init_ro_start)
44 #define VCORE_INIT_RO_SZ	((size_t)(__vcore_init_ro_end - \
45 					  __vcore_init_ro_start))
46 
47 #define VCORE_START_VA		((vaddr_t)__text_start)
48 
49 #define EMIT_SECTION_INFO_SYMBOLS(section_name) \
50 	extern const uint8_t __vcore_ ## section_name ## _start[]; \
51 	extern const uint8_t __vcore_ ## section_name ## _end[]; \
52 	extern const uint8_t __vcore_ ## section_name ## _size[]
53 
54 EMIT_SECTION_INFO_SYMBOLS(unpg_rx);
55 EMIT_SECTION_INFO_SYMBOLS(unpg_ro);
56 EMIT_SECTION_INFO_SYMBOLS(unpg_rw);
57 EMIT_SECTION_INFO_SYMBOLS(nex_rw);
58 EMIT_SECTION_INFO_SYMBOLS(init_ro);
59 EMIT_SECTION_INFO_SYMBOLS(init_rx);
60 
61 #undef EMIT_SECTION_INFO_SYMBOLS
62 
63 extern const uint8_t __text_start[];
64 extern const uint8_t __text_data_start[];
65 extern const uint8_t __text_data_end[];
66 extern const uint8_t __text_end[];
67 extern const uint8_t __end[];
68 
69 extern const uint8_t __identity_map_init_start[];
70 extern const uint8_t __identity_map_init_end[];
71 
72 extern uint8_t __data_start[];
73 extern const uint8_t __data_end[];
74 extern const uint8_t __rodata_start[];
75 extern const uint8_t __rodata_end[];
76 extern const uint8_t __bss_start[];
77 extern const uint8_t __bss_end[];
78 extern const uint8_t __nozi_start[];
79 extern const uint8_t __nozi_end[];
80 extern const uint8_t __nozi_stack_start[];
81 extern const uint8_t __nozi_stack_end[];
82 extern const uint8_t __init_start[];
83 extern const uint8_t __init_end[];
84 
85 extern uint8_t __heap1_start[];
86 extern const uint8_t __heap1_end[];
87 extern uint8_t __heap2_start[];
88 extern const uint8_t __heap2_end[];
89 
90 extern uint8_t __nex_heap_start[];
91 extern const uint8_t __nex_heap_end[];
92 
93 extern const uint8_t __pageable_part_start[];
94 extern const uint8_t __pageable_part_end[];
95 extern const uint8_t __pageable_start[];
96 extern const uint8_t __pageable_end[];
97 
98 extern const uint8_t __rodata_init_start[];
99 extern const uint8_t __rodata_init_end[];
100 extern const uint8_t __rodata_pageable_start[];
101 extern const uint8_t __rodata_pageable_end[];
102 extern const uint8_t __text_init_start[];
103 extern const uint8_t __text_init_end[];
104 extern const uint8_t __text_pageable_start[];
105 extern const uint8_t __text_pageable_end[];
106 
107 #define ASAN_SHADOW_PA	((paddr_t)(vaddr_t)__asan_shadow_start)
108 #define ASAN_SHADOW_SZ	((size_t)__asan_shadow_size)
109 extern const uint8_t __asan_shadow_start[];
110 extern const uint8_t __asan_shadow_end[];
111 extern const uint8_t __asan_shadow_size[];
112 
113 #define ASAN_MAP_PA	((paddr_t)(vaddr_t)__asan_map_start)
114 #define ASAN_MAP_SZ	((size_t)__asan_map_size)
115 extern const uint8_t __asan_map_start[];
116 extern const uint8_t __asan_map_end[];
117 extern const uint8_t __asan_map_size[];
118 
119 extern const vaddr_t __ctor_list;
120 extern const vaddr_t __ctor_end;
121 
122 /* Generated by core/arch/$(ARCH)/kernel/link.mk */
123 extern const char core_v_str[];
124 
125 #endif /*__KERNEL_LINKER_H*/
126 
127