From 818aaa8b893b79558095fe80af62ffcfe696b6b5 Mon Sep 17 00:00:00 2001 From: Guokai Chen Date: Sun, 23 Jan 2022 22:15:09 +0800 Subject: [PATCH] Fix macOS arm64 build by excluding x86 only cpuid header (#3285) (#3291) Signed-off-by: Guokai Chen --- docs/CONTRIBUTORS | 1 + include/verilated_threads.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/CONTRIBUTORS b/docs/CONTRIBUTORS index 6b55ee4dc..599449709 100644 --- a/docs/CONTRIBUTORS +++ b/docs/CONTRIBUTORS @@ -28,6 +28,7 @@ Geza Lore Gianfranco Costamagna Glen Gibb Graham Rushton +Guokai Chen Harald Heckmann Howard Su Huang Rui diff --git a/include/verilated_threads.h b/include/verilated_threads.h index 698e492f6..ffaf02e98 100644 --- a/include/verilated_threads.h +++ b/include/verilated_threads.h @@ -43,7 +43,7 @@ #if defined(__linux) # include // For sched_getcpu() #endif -#if defined(__APPLE__) +#if defined(__APPLE__) && !defined(__arm64__) # include // For __cpuid_count() #endif // clang-format on @@ -168,7 +168,7 @@ public: static int getcpu() { // Return current executing CPU #if defined(__linux) return sched_getcpu(); -#elif defined(__APPLE__) +#elif defined(__APPLE__) && !defined(__arm64__) vluint32_t info[4]; __cpuid_count(1, 0, info[0], info[1], info[2], info[3]); // info[1] is EBX, bits 24-31 are APIC ID