Skip to content

[PAC][compiler-rt] Do not use __has_feature with non-clang #102154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions compiler-rt/lib/builtins/crtbegin.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ static void __attribute__((used)) __do_init(void) {
}

#ifdef CRT_HAS_INITFINI_ARRAY
#ifdef __clang__
#if __has_feature(ptrauth_init_fini)
// TODO: use __ptrauth-qualified pointers when they are supported on clang side
#if __has_feature(ptrauth_init_fini_address_discrimination)
Expand All @@ -70,6 +71,10 @@ __attribute__((section(".init_array"), used)) static void *__init =
__attribute__((section(".init_array"),
used)) static void (*__init)(void) = __do_init;
#endif
#else
__attribute__((section(".init_array"),
used)) static void (*__init)(void) = __do_init;
#endif
#elif defined(__i386__) || defined(__x86_64__)
__asm__(".pushsection .init,\"ax\",@progbits\n\t"
"call __do_init\n\t"
Expand Down Expand Up @@ -125,6 +130,7 @@ static void __attribute__((used)) __do_fini(void) {
}

#ifdef CRT_HAS_INITFINI_ARRAY
#ifdef __clang__
#if __has_feature(ptrauth_init_fini)
// TODO: use __ptrauth-qualified pointers when they are supported on clang side
#if __has_feature(ptrauth_init_fini_address_discrimination)
Expand All @@ -141,6 +147,10 @@ __attribute__((section(".fini_array"), used)) static void *__fini =
__attribute__((section(".fini_array"),
used)) static void (*__fini)(void) = __do_fini;
#endif
#else
__attribute__((section(".fini_array"),
used)) static void (*__fini)(void) = __do_fini;
#endif
#elif defined(__i386__) || defined(__x86_64__)
__asm__(".pushsection .fini,\"ax\",@progbits\n\t"
"call __do_fini\n\t"
Expand Down
Loading