Skip to content

Commit b37ee52

Browse files
committed
Use __PTRAUTH__ macro to detect presence of ptrauth.h include
In llvm/llvm-project#153912, usage of `__has_feature(ptrauth_intrinsics)` was restricted to Darwin-only, while `__PTRAUTH__` macro was introduced instead. This patch makes use of a preprocessor check against `__PTRAUTH__` macro in addition to previously used `__has_feature(ptrauth_intrinsics)`. The latter check is kept for backward compatibility.
1 parent b6166c8 commit b37ee52

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

arch/aarch64/reloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#define CRTJMP(pc,sp) __asm__ __volatile__( \
3434
"mov sp,%1 ; br %0" : : "r"(pc), "r"(sp) : "memory" )
3535

36-
#if __has_feature(ptrauth_intrinsics)
36+
#if defined(__PTRAUTH__) || __has_feature(ptrauth_intrinsics)
3737

3838
#include <stdint.h>
3939

ldso/dynlink.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <dlfcn.h>
2121
#include <semaphore.h>
2222
#include <sys/membarrier.h>
23-
#if __has_feature(ptrauth_intrinsics)
23+
#if defined(__PTRAUTH__) || __has_feature(ptrauth_intrinsics)
2424
#include <ptrauth.h>
2525
#endif
2626
#include "pthread_impl.h"
@@ -566,7 +566,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
566566
reloc_addr[0] = (size_t)__tlsdesc_dynamic;
567567
reloc_addr[1] = (size_t)new;
568568
} else {
569-
#if __has_feature(ptrauth_intrinsics) && !__has_feature(ptrauth_elf_got)
569+
#if (defined(__PTRAUTH__) || __has_feature(ptrauth_intrinsics)) && !__has_feature(ptrauth_elf_got)
570570
reloc_addr[0] = (size_t)ptrauth_strip(&__tlsdesc_static, 0);
571571
#else
572572
reloc_addr[0] = (size_t)__tlsdesc_static;

src/ldso/aarch64/reloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "reloc.h"
22

3-
#if __has_feature(ptrauth_intrinsics)
3+
#if defined(__PTRAUTH__) || __has_feature(ptrauth_intrinsics)
44

55
#include <stdint.h>
66

0 commit comments

Comments
 (0)