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 __text_data_start[]; 81 extern const uint8_t __text_data_end[]; 82 extern const uint8_t __text_end[]; 83 extern const uint8_t __end[]; 84 85 extern const uint8_t __identity_map_init_start[]; 86 extern const uint8_t __identity_map_init_end[]; 87 88 extern uint8_t __data_start[]; 89 extern const uint8_t __data_end[]; 90 extern const uint8_t __rodata_start[]; 91 extern const uint8_t __rodata_end[]; 92 extern const uint8_t __bss_start[]; 93 extern const uint8_t __bss_end[]; 94 extern const uint8_t __nozi_start[]; 95 extern const uint8_t __nozi_end[]; 96 extern const uint8_t __nozi_stack_start[]; 97 extern const uint8_t __nozi_stack_end[]; 98 extern const uint8_t __init_start[]; 99 extern const uint8_t __init_end[]; 100 101 extern uint8_t __heap1_start[]; 102 extern const uint8_t __heap1_end[]; 103 extern uint8_t __heap2_start[]; 104 extern const uint8_t __heap2_end[]; 105 106 extern uint8_t __nex_heap_start[]; 107 extern const uint8_t __nex_heap_end[]; 108 109 extern const uint8_t __pageable_part_start[]; 110 extern const uint8_t __pageable_part_end[]; 111 extern const uint8_t __pageable_start[]; 112 extern const uint8_t __pageable_end[]; 113 114 extern const uint8_t __rodata_init_start[]; 115 extern const uint8_t __rodata_init_end[]; 116 extern const uint8_t __rodata_pageable_start[]; 117 extern const uint8_t __rodata_pageable_end[]; 118 extern const uint8_t __text_init_start[]; 119 extern const uint8_t __text_init_end[]; 120 extern const uint8_t __text_pageable_start[]; 121 extern const uint8_t __text_pageable_end[]; 122 123 #define ASAN_SHADOW_PA ((paddr_t)__asan_shadow_start) 124 #define ASAN_SHADOW_SZ ((size_t)__asan_shadow_size) 125 extern const uint8_t __asan_shadow_start[]; 126 extern const uint8_t __asan_shadow_end[]; 127 extern const uint8_t __asan_shadow_size[]; 128 129 #define ASAN_MAP_PA ((paddr_t)__asan_map_start) 130 #define ASAN_MAP_SZ ((size_t)__asan_map_size) 131 extern const uint8_t __asan_map_start[]; 132 extern const uint8_t __asan_map_end[]; 133 extern const uint8_t __asan_map_size[]; 134 135 extern const vaddr_t __ctor_list; 136 extern const vaddr_t __ctor_end; 137 138 /* Generated by core/arch/$(ARCH)/kernel/link.mk */ 139 extern const char core_v_str[]; 140 141 #endif /*__KERNEL_LINKER_H*/ 142 143