================ @@ -1259,6 +1270,64 @@ struct { // As features grows new fields could be added } __aarch64_cpu_features __attribute__((visibility("hidden"), nocommon)); +#if defined(__APPLE__) +#include <TargetConditionals.h> +#if TARGET_OS_OSX || TARGET_OS_IPHONE +#include <dispatch/dispatch.h> +#include <sys/sysctl.h> + +static bool isKnownAndSupported(const char *name) { + int32_t val = 0; + size_t size = sizeof(val); + if (sysctlbyname(name, &val, &size, NULL, 0)) + return false; + return val; +} + +void __init_cpu_features_resolver(void) { + static dispatch_once_t onceToken = 0; + dispatch_once(&onceToken, ^{ ---------------- MaskRay wrote:
Thanks for the explanation. If `__init_cpu_features_resolver` can be called concurrently, I think it is worth a comment, since the other `__init_*` functions are guaranteed to be very early in the program startup sequence and is serial. https://github.com/llvm/llvm-project/pull/73685 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits