File tree Expand file tree Collapse file tree 3 files changed +23
-9
lines changed Expand file tree Collapse file tree 3 files changed +23
-9
lines changed Original file line number Diff line number Diff line change 212212# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 287
213213#endif // _LIBUNWIND_IS_NATIVE_ONLY
214214
215- #if __has_feature (ptrauth_calls ) && __has_feature (ptrauth_returns )
216- # define _LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING 1
217- #elif __has_feature (ptrauth_calls ) != __has_feature (ptrauth_returns )
218- # error "Either both or none of ptrauth_calls and ptrauth_returns "\
219- "is allowed to be enabled"
215+ #if defined(__has_feature )
216+ # if __has_feature (ptrauth_calls ) && __has_feature (ptrauth_returns )
217+ # define _LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING 1
218+ # elif __has_feature (ptrauth_calls ) != __has_feature (ptrauth_returns )
219+ # error "Either both or none of ptrauth_calls and ptrauth_returns "\
220+ "is allowed to be enabled"
221+ # endif
220222#endif
221223
222224#endif // ____LIBUNWIND_CONFIG_H__
Original file line number Diff line number Diff line change @@ -634,6 +634,12 @@ Lnovec:
634634
635635#elif defined(__aarch64__)
636636
637+ #ifdef __has_feature
638+ #define __has_ptrauth_calls __has_feature(ptrauth_calls)
639+ #else
640+ #define __has_ptrauth_calls 0
641+ #endif
642+
637643#if defined(__ARM_FEATURE_GCS_DEFAULT)
638644.arch_extension gcs
639645#endif
@@ -690,7 +696,7 @@ DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_arm64_jumpto)
690696 ldr x16, [x0, #0x0F8] // load sp into scratch
691697 ldr lr, [x0, #0x100] // restore pc into lr
692698
693- #if __has_feature(ptrauth_calls)
699+ #if __has_ptrauth_calls
694700 // The LR is signed with its address inside the register state. Time
695701 // to resign to be a regular ROP protected signed pointer
696702 add x1, x0, #0x100
@@ -711,7 +717,7 @@ DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_arm64_jumpto)
711717Lnogcs:
712718#endif
713719
714- #if __has_feature(ptrauth_calls)
720+ #if __has_ptrauth_calls
715721 retab
716722#else
717723 ret x30 // jump to pc
Original file line number Diff line number Diff line change @@ -763,6 +763,12 @@ LnoR2Fix:
763763
764764#elif defined(__aarch64__)
765765
766+ #ifdef __has_feature
767+ #define __has_ptrauth_calls __has_feature(ptrauth_calls)
768+ #else
769+ #define __has_ptrauth_calls 0
770+ #endif
771+
766772//
767773// extern int __unw_getcontext(unw_context_t* thread_state)
768774//
@@ -772,7 +778,7 @@ LnoR2Fix:
772778 .p2align 2
773779DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
774780
775- #if __has_feature(ptrauth_calls)
781+ #if __has_ptrauth_calls
776782 pacibsp
777783#endif
778784
@@ -817,7 +823,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
817823#endif
818824 mov x0, #0 // return UNW_ESUCCESS
819825
820- #if __has_feature(ptrauth_calls)
826+ #if __has_ptrauth_calls
821827 retab
822828#else
823829 ret
You can’t perform that action at this time.
0 commit comments