From 0b6b8a3e5c79f14e2e61d0c5023cf4a5e13ca570 Mon Sep 17 00:00:00 2001 From: "Thomas A." Date: Tue, 7 May 2024 18:20:14 -0700 Subject: [PATCH] Set Fall Back Arch To The Primary Arch For MIG I was looking through the build scripts in XNU to see how MIG is being used. While there are some cases where we need to explicitly set the arch to its 32-bit equivalent (ex: i386 instead of x86-64), those situations seem to be the exception rather than the norm. As a result, I don't think we should be hardcoding i386 as a fallback. We should use the primary architecture instead. --- cmake/architecture.cmake | 2 ++ cmake/mig.cmake | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/architecture.cmake b/cmake/architecture.cmake index ace5a7cb0..1f6553472 100644 --- a/cmake/architecture.cmake +++ b/cmake/architecture.cmake @@ -28,8 +28,10 @@ macro(generate_architecture) if (BUILD_TARGET_64BIT) set(APPLE_TARGET_TRIPLET_PRIMARY ${APPLE_TARGET_TRIPLET_64BIT}) + set(APPLE_ARCH_PRIMARY ${APPLE_ARCH_64BIT}) elseif (BUILD_TARGET_32BIT) set(APPLE_TARGET_TRIPLET_PRIMARY ${APPLE_TARGET_TRIPLET_32BIT}) + set(APPLE_ARCH_PRIMARY ${APPLE_ARCH_32BIT}) else () set(APPLE_TARGET_TRIPLET_PRIMARY "") endif () diff --git a/cmake/mig.cmake b/cmake/mig.cmake index 7e9c6bc3d..256cd54ec 100644 --- a/cmake/mig.cmake +++ b/cmake/mig.cmake @@ -38,7 +38,7 @@ function(mig defFileName) if (NOT MIG_MULTIARCH) set(MIG_MULTIARCH_NO_SUFFIX 1) if (NOT MIG_ARCH) - set(MIG_MULTIARCH "i386") + set(MIG_MULTIARCH "${APPLE_ARCH_PRIMARY}") else() set(MIG_MULTIARCH "${MIG_ARCH}") endif()