Closed asl closed 11 months ago
No changes except the change already introduced in libcxx e8ecdfc3d411e5c3e4207f70f94972083e636cbf are required.
Despite the fact that __aarch64__
isn't subtarget-specific (and is defined on Apple targets together with __arm64__
), there are many places where constructions like the following are used:
#if defined(__arm64__) || defined(__aarch64__)
So, it looks like it's a pattern to use them together. Maybe in past __aarch64__
was not defined for Apple's targets and we still have additional check against __arm64__
for compatibility reasons instead of a single check against __aarch64__
, maybe there are other historical reasons for such a pattern. Anyway, I consider we can keep it in libcxx as well instead of relying on just __aarch64__
- this is unneeded verbosity, but it keeps things uniform.
Actually, the already fixed __arm64__
usage in libcxx was the only place where both following conditions are true:
__aarch64__
.So, there are no non-Apple-specific places where only __arm64__
is checked and which should be fixed by checking __aarch64__
as well.
__arm64e__
is only used in Apple-specific code except one place: compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp. There, we define --default-arch
argument for llvm-symbolizer depending on defined macros. We should probably check the llvm-symbolizer behavior for such a case.
But maybe we can use __has_feature
check here? So, the attribute will be enabled only when pauth ABI is in use?
Thanks @asl, I've added a check against __has_feature(ptrauth_calls)
here 52420441eaa2ceafa9b7a4d205179f9d21d1b00f: vtable signing is unconditionally enabled when ptrauth-calls are enabled, the only thing that a user can change is whether type/address discrimination are enabled. I've also checked if other places with clang::ptrauth*
attributes need to be changed - fortunately, there are no such places.
__arm64__
define is Apple-specific, however its usage might be misleading. It would make sense to normalize defines usage:__arm64e__
define for apple-specific cases__aarch64__
for common onesWe need to check all usages of
__arm64__
/__arm64e__
to ensure proper functionality