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 __arm__ 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 /* 29 * Warning! (ASLR) Do not use any of the _SZ_UNSAFE defines or _size[] variables 30 * below in code that runs after dynamic relocations have been applied. Their 31 * value could be *wrong* after relocation (for instance Aarch64 GCC 9.2 32 * generates dynamic relocations for the _size[] symbols, but Clang 11.0.0 does 33 * not). The _SZ_UNSAFE macros are mostly here for use in register_phys_mem() 34 * where the _SZ macros would be rejected by the compiler ('initializer element 35 * is not constant'). Other uses are likely to be incorrect. 36 */ 37 38 #define VCORE_UNPG_RX_PA ((unsigned long)__vcore_unpg_rx_start) 39 #define VCORE_UNPG_RX_SZ_UNSAFE ((size_t)__vcore_unpg_rx_size) 40 #define VCORE_UNPG_RX_SZ ((size_t)(__vcore_unpg_rx_end - \ 41 __vcore_unpg_rx_start)) 42 #define VCORE_UNPG_RO_PA ((unsigned long)__vcore_unpg_ro_start) 43 #define VCORE_UNPG_RO_SZ_UNSAFE ((size_t)__vcore_unpg_ro_size) 44 #define VCORE_UNPG_RO_SZ ((size_t)(__vcore_unpg_ro_end - \ 45 __vcore_unpg_ro_start)) 46 #define VCORE_UNPG_RW_PA ((unsigned long)__vcore_unpg_rw_start) 47 #define VCORE_UNPG_RW_SZ_UNSAFE ((size_t)__vcore_unpg_rw_size) 48 #define VCORE_UNPG_RW_SZ ((size_t)(__vcore_unpg_rw_end - \ 49 __vcore_unpg_rw_start)) 50 #define VCORE_NEX_RW_PA ((unsigned long)__vcore_nex_rw_start) 51 #define VCORE_NEX_RW_SZ_UNSAFE ((size_t)__vcore_nex_rw_size) 52 #define VCORE_NEX_RW_SZ ((size_t)__vcore_nex_rw_end - \ 53 __vcore_nex_rw_start) 54 #define VCORE_INIT_RX_PA ((unsigned long)__vcore_init_rx_start) 55 #define VCORE_INIT_RX_SZ_UNSAFE ((size_t)__vcore_init_rx_size) 56 #define VCORE_INIT_RX_SZ ((size_t)(__vcore_init_rx_end - \ 57 __vcore_init_rx_start)) 58 #define VCORE_INIT_RO_PA ((unsigned long)__vcore_init_ro_start) 59 #define VCORE_INIT_RO_SZ_UNSAFE ((size_t)__vcore_init_ro_size) 60 #define VCORE_INIT_RO_SZ ((size_t)(__vcore_init_ro_end - \ 61 __vcore_init_ro_start)) 62 63 #define VCORE_START_VA ((vaddr_t)__text_start) 64 65 #define EMIT_SECTION_INFO_SYMBOLS(section_name) \ 66 extern const uint8_t __vcore_ ## section_name ## _start[]; \ 67 extern const uint8_t __vcore_ ## section_name ## _end[]; \ 68 extern const uint8_t __vcore_ ## section_name ## _size[] 69 70 EMIT_SECTION_INFO_SYMBOLS(unpg_rx); 71 EMIT_SECTION_INFO_SYMBOLS(unpg_ro); 72 EMIT_SECTION_INFO_SYMBOLS(unpg_rw); 73 EMIT_SECTION_INFO_SYMBOLS(nex_rw); 74 EMIT_SECTION_INFO_SYMBOLS(init_ro); 75 EMIT_SECTION_INFO_SYMBOLS(init_rx); 76 77 #undef EMIT_SECTION_INFO_SYMBOLS 78 79 extern const uint8_t __text_start[]; 80 extern const uint8_t __end[]; 81 82 extern const uint8_t __identity_map_init_start[]; 83 extern const uint8_t __identity_map_init_end[]; 84 85 extern uint8_t __data_start[]; 86 extern const uint8_t __data_end[]; 87 extern const uint8_t __rodata_start[]; 88 extern const uint8_t __rodata_end[]; 89 extern const uint8_t __bss_start[]; 90 extern const uint8_t __bss_end[]; 91 extern const uint8_t __nozi_start[]; 92 extern const uint8_t __nozi_end[]; 93 extern const uint8_t __nozi_stack_start[]; 94 extern const uint8_t __nozi_stack_end[]; 95 extern const uint8_t __init_start[]; 96 extern const uint8_t __init_end[]; 97 98 extern uint8_t __heap1_start[]; 99 extern const uint8_t __heap1_end[]; 100 extern uint8_t __heap2_start[]; 101 extern const uint8_t __heap2_end[]; 102 103 extern uint8_t __nex_heap_start[]; 104 extern const uint8_t __nex_heap_end[]; 105 106 extern const uint8_t __pageable_part_start[]; 107 extern const uint8_t __pageable_part_end[]; 108 extern const uint8_t __pageable_start[]; 109 extern const uint8_t __pageable_end[]; 110 111 #define ASAN_SHADOW_PA ((paddr_t)__asan_shadow_start) 112 #define ASAN_SHADOW_SZ ((size_t)__asan_shadow_size) 113 extern const uint8_t __asan_shadow_start[]; 114 extern const uint8_t __asan_shadow_end[]; 115 extern const uint8_t __asan_shadow_size[]; 116 117 #define ASAN_MAP_PA ((paddr_t)__asan_map_start) 118 #define ASAN_MAP_SZ ((size_t)__asan_map_size) 119 extern const uint8_t __asan_map_start[]; 120 extern const uint8_t __asan_map_end[]; 121 extern const uint8_t __asan_map_size[]; 122 123 extern const vaddr_t __ctor_list; 124 extern const vaddr_t __ctor_end; 125 126 /* Generated by core/arch/$(ARCH)/kernel/link.mk */ 127 extern const char core_v_str[]; 128 129 #endif /*__KERNEL_LINKER_H*/ 130 131