Express arm64e via an additional constraint rather than a new cpu constraint PiperOrigin-RevId: 822571984 (cherry picked from commit 1d41e81912acd95a1b0f301b64b6538530a63b1b)
diff --git a/constraints/BUILD b/constraints/BUILD index c58ac67..c08006d 100644 --- a/constraints/BUILD +++ b/constraints/BUILD
@@ -48,6 +48,20 @@ constraint_setting = ":target_vendor", ) +# A constraint to indicate whether the platform supports Apple's pointer +# authentication. +constraint_setting( + name = "pointer_authentication_setting", + visibility = ["//visibility:private"], +) + +# If a platform has this constraint_value, it supports Apple's pointer +# authentication. +constraint_value( + name = "pointer_authentication", + constraint_setting = ":pointer_authentication_setting", +) + # Consumed by bazel tests. filegroup( name = "for_bazel_tests",
diff --git a/lib/apple_support.bzl b/lib/apple_support.bzl index e430705..7253802 100644 --- a/lib/apple_support.bzl +++ b/lib/apple_support.bzl
@@ -276,6 +276,9 @@ "_x86_64_constraint": attr.label( default = Label("@platforms//cpu:x86_64"), ), + "_pointer_authentication_constraint": attr.label( + default = Label("@build_bazel_apple_support//constraints:pointer_authentication"), + ), "_apple_device_constraint": attr.label( default = Label("//constraints:device"), ), @@ -477,8 +480,15 @@ arm64_32_constraint = ctx.attr._arm64_32_constraint[platform_common.ConstraintValueInfo] x86_64_constraint = ctx.attr._x86_64_constraint[platform_common.ConstraintValueInfo] + pointer_authentication_constraint = ( + ctx.attr._pointer_authentication_constraint[platform_common.ConstraintValueInfo] + ) + if ctx.target_platform_has_constraint(arm64_constraint): - return "arm64" + if ctx.target_platform_has_constraint(pointer_authentication_constraint): + return "arm64e" + else: + return "arm64" elif ctx.target_platform_has_constraint(arm64e_constraint): return "arm64e" elif ctx.target_platform_has_constraint(arm64_32_constraint):