From 33e1713a00a5291e5de658d0eb0aebdbf1d3aa03 Mon Sep 17 00:00:00 2001 From: Dan F-M Date: Tue, 21 Sep 2021 12:19:07 -0700 Subject: [PATCH] [Bazel] Add support for targeting macOS arm64 In attempting to build JAX on Apple Silicon, we discovered an issue with the bazel configuration in llvm-project-overlay. This patch fixes the logic, at least when building JAX. More context is included on the following GitHub issue: https://github.com/google/jax/issues/5501 Differential Revision: https://reviews.llvm.org/D109839 --- utils/bazel/llvm-project-overlay/llvm/config.bzl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/bazel/llvm-project-overlay/llvm/config.bzl b/utils/bazel/llvm-project-overlay/llvm/config.bzl index 55f3077bff74..ff64df694048 100644 --- a/utils/bazel/llvm-project-overlay/llvm/config.bzl +++ b/utils/bazel/llvm-project-overlay/llvm/config.bzl @@ -76,7 +76,8 @@ os_defines = select({ # TODO: We should split out host vs. target here. llvm_config_defines = os_defines + select({ "@bazel_tools//src/conditions:windows": native_arch_defines("X86", "x86_64-pc-win32"), - "@bazel_tools//src/conditions:darwin": native_arch_defines("X86", "x86_64-unknown-darwin"), + "@bazel_tools//src/conditions:darwin_arm64": native_arch_defines("AArch64", "arm64-apple-darwin"), + "@bazel_tools//src/conditions:darwin_x86_64": native_arch_defines("X86", "x86_64-unknown-darwin"), "@bazel_tools//src/conditions:linux_aarch64": native_arch_defines("AArch64", "aarch64-unknown-linux-gnu"), "//conditions:default": native_arch_defines("X86", "x86_64-unknown-linux-gnu"), }) + [