1 //===--------------------- Unwind_AppleExtras.cpp -------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "config.h" 11 #include "AddressSpace.hpp" 12 #include "DwarfParser.hpp" 13 14 15 // static linker symbols to prevent wrong two level namespace for _Unwind symbols 16 #if defined(__arm__) 17 #define NOT_HERE_BEFORE_5_0(sym) \ 18 extern const char sym##_tmp30 __asm("$ld$hide$os3.0$_" #sym ); \ 19 __attribute__((visibility("default"))) const char sym##_tmp30 = 0; \ 20 extern const char sym##_tmp31 __asm("$ld$hide$os3.1$_" #sym ); \ 21 __attribute__((visibility("default"))) const char sym##_tmp31 = 0; \ 22 extern const char sym##_tmp32 __asm("$ld$hide$os3.2$_" #sym );\ 23 __attribute__((visibility("default"))) const char sym##_tmp32 = 0; \ 24 extern const char sym##_tmp40 __asm("$ld$hide$os4.0$_" #sym ); \ 25 __attribute__((visibility("default"))) const char sym##_tmp40 = 0; \ 26 extern const char sym##_tmp41 __asm("$ld$hide$os4.1$_" #sym ); \ 27 __attribute__((visibility("default"))) const char sym##_tmp41 = 0; \ 28 extern const char sym##_tmp42 __asm("$ld$hide$os4.2$_" #sym ); \ 29 __attribute__((visibility("default"))) const char sym##_tmp42 = 0; \ 30 extern const char sym##_tmp43 __asm("$ld$hide$os4.3$_" #sym ); \ 31 __attribute__((visibility("default"))) const char sym##_tmp43 = 0; 32 #elif defined(__aarch64__) 33 #define NOT_HERE_BEFORE_10_6(sym) 34 #define NEVER_HERE(sym) 35 #else 36 #define NOT_HERE_BEFORE_10_6(sym) \ 37 extern const char sym##_tmp4 __asm("$ld$hide$os10.4$_" #sym ); \ 38 __attribute__((visibility("default"))) const char sym##_tmp4 = 0; \ 39 extern const char sym##_tmp5 __asm("$ld$hide$os10.5$_" #sym ); \ 40 __attribute__((visibility("default"))) const char sym##_tmp5 = 0; 41 #define NEVER_HERE(sym) \ 42 extern const char sym##_tmp4 __asm("$ld$hide$os10.4$_" #sym ); \ 43 __attribute__((visibility("default"))) const char sym##_tmp4 = 0; \ 44 extern const char sym##_tmp5 __asm("$ld$hide$os10.5$_" #sym ); \ 45 __attribute__((visibility("default"))) const char sym##_tmp5 = 0; \ 46 extern const char sym##_tmp6 __asm("$ld$hide$os10.6$_" #sym ); \ 47 __attribute__((visibility("default"))) const char sym##_tmp6 = 0; 48 #endif 49 50 51 #if defined(_LIBUNWIND_BUILD_ZERO_COST_APIS) 52 53 // 54 // symbols in libSystem.dylib in 10.6 and later, but are in libgcc_s.dylib in 55 // earlier versions 56 // 57 NOT_HERE_BEFORE_10_6(_Unwind_DeleteException) 58 NOT_HERE_BEFORE_10_6(_Unwind_Find_FDE) 59 NOT_HERE_BEFORE_10_6(_Unwind_ForcedUnwind) 60 NOT_HERE_BEFORE_10_6(_Unwind_GetGR) 61 NOT_HERE_BEFORE_10_6(_Unwind_GetIP) 62 NOT_HERE_BEFORE_10_6(_Unwind_GetLanguageSpecificData) 63 NOT_HERE_BEFORE_10_6(_Unwind_GetRegionStart) 64 NOT_HERE_BEFORE_10_6(_Unwind_RaiseException) 65 NOT_HERE_BEFORE_10_6(_Unwind_Resume) 66 NOT_HERE_BEFORE_10_6(_Unwind_SetGR) 67 NOT_HERE_BEFORE_10_6(_Unwind_SetIP) 68 NOT_HERE_BEFORE_10_6(_Unwind_Backtrace) 69 NOT_HERE_BEFORE_10_6(_Unwind_FindEnclosingFunction) 70 NOT_HERE_BEFORE_10_6(_Unwind_GetCFA) 71 NOT_HERE_BEFORE_10_6(_Unwind_GetDataRelBase) 72 NOT_HERE_BEFORE_10_6(_Unwind_GetTextRelBase) 73 NOT_HERE_BEFORE_10_6(_Unwind_Resume_or_Rethrow) 74 NOT_HERE_BEFORE_10_6(_Unwind_GetIPInfo) 75 NOT_HERE_BEFORE_10_6(__register_frame) 76 NOT_HERE_BEFORE_10_6(__deregister_frame) 77 78 // 79 // symbols in libSystem.dylib for compatibility, but we don't want any new code 80 // using them 81 // 82 NEVER_HERE(__register_frame_info_bases) 83 NEVER_HERE(__register_frame_info) 84 NEVER_HERE(__register_frame_info_table_bases) 85 NEVER_HERE(__register_frame_info_table) 86 NEVER_HERE(__register_frame_table) 87 NEVER_HERE(__deregister_frame_info) 88 NEVER_HERE(__deregister_frame_info_bases) 89 90 #endif // defined(_LIBUNWIND_BUILD_ZERO_COST_APIS) 91 92 93 94 95 #if defined(_LIBUNWIND_BUILD_SJLJ_APIS) 96 // 97 // symbols in libSystem.dylib in iOS 5.0 and later, but are in libgcc_s.dylib in 98 // earlier versions 99 // 100 NOT_HERE_BEFORE_5_0(_Unwind_GetLanguageSpecificData) 101 NOT_HERE_BEFORE_5_0(_Unwind_GetRegionStart) 102 NOT_HERE_BEFORE_5_0(_Unwind_GetIP) 103 NOT_HERE_BEFORE_5_0(_Unwind_SetGR) 104 NOT_HERE_BEFORE_5_0(_Unwind_SetIP) 105 NOT_HERE_BEFORE_5_0(_Unwind_DeleteException) 106 NOT_HERE_BEFORE_5_0(_Unwind_SjLj_Register) 107 NOT_HERE_BEFORE_5_0(_Unwind_GetGR) 108 NOT_HERE_BEFORE_5_0(_Unwind_GetIPInfo) 109 NOT_HERE_BEFORE_5_0(_Unwind_GetCFA) 110 NOT_HERE_BEFORE_5_0(_Unwind_SjLj_Resume) 111 NOT_HERE_BEFORE_5_0(_Unwind_SjLj_RaiseException) 112 NOT_HERE_BEFORE_5_0(_Unwind_SjLj_Resume_or_Rethrow) 113 NOT_HERE_BEFORE_5_0(_Unwind_SjLj_Unregister) 114 115 #endif // defined(_LIBUNWIND_BUILD_SJLJ_APIS) 116