Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[apple] support watchos_arm64 in toolchain #14512

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tools/osx/crosstool/BUILD.toolchains
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ OSX_TOOLS_CONSTRAINTS = {
"@platforms//os:ios",
"@platforms//cpu:x86_64",
],
"watchos_arm64": [
"@platforms//os:ios",
"@platforms//cpu:aarch64",
],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this will conflict with the one below or if there's a different CPU that should be used for one or the other?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it may in the future. If the constraints are the same, toolchain resolution would pick this one first.
But, what is up with the name watchos_arm64_32?
That entry is strange with a name that implies 32 bits, while using aarch64.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arm64_32 is a variant of arm64 with 32-bit pointer sizes, used on Apple Watch Series 4 and later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure about these. But ios_sim_arm64 and ios_arm64 are identical here too, so if it's wrong what's in here already is wrong.

"watchos_arm64_32": [
"@platforms//os:ios",
"@platforms//cpu:aarch64",
Expand Down
21 changes: 15 additions & 6 deletions tools/osx/crosstool/cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def _impl(ctx):
target_system_name = "x86_64-apple-ios"
elif (ctx.attr.cpu == "ios_sim_arm64"):
target_system_name = "arm64-apple-ios-simulator"
elif (ctx.attr.cpu == "watchos_arm64"):
target_system_name = "arm64-apple-watchos-simulator"
elif (ctx.attr.cpu == "darwin_x86_64"):
target_system_name = "x86_64-apple-macosx"
elif (ctx.attr.cpu == "darwin_arm64"):
Expand Down Expand Up @@ -744,7 +746,8 @@ def _impl(ctx):
ctx.attr.cpu == "watchos_arm64_32" or
ctx.attr.cpu == "watchos_armv7k" or
ctx.attr.cpu == "watchos_i386" or
ctx.attr.cpu == "watchos_x86_64"):
ctx.attr.cpu == "watchos_x86_64" or
ctx.attr.cpu == "watchos_arm64"):
apply_default_compiler_flags_feature = feature(
name = "apply_default_compiler_flags",
flag_sets = [
Expand Down Expand Up @@ -928,7 +931,8 @@ def _impl(ctx):
ctx.attr.cpu == "ios_sim_arm64" or
ctx.attr.cpu == "tvos_x86_64" or
ctx.attr.cpu == "watchos_i386" or
ctx.attr.cpu == "watchos_x86_64"):
ctx.attr.cpu == "watchos_x86_64" or
ctx.attr.cpu == "watchos_arm64"):
apply_simulator_compiler_flags_feature = feature(
name = "apply_simulator_compiler_flags",
flag_sets = [
Expand Down Expand Up @@ -1000,7 +1004,8 @@ def _impl(ctx):
ctx.attr.cpu == "watchos_arm64_32" or
ctx.attr.cpu == "watchos_armv7k" or
ctx.attr.cpu == "watchos_i386" or
ctx.attr.cpu == "watchos_x86_64"):
ctx.attr.cpu == "watchos_x86_64" or
ctx.attr.cpu == "watchos_arm64"):
contains_objc_source_feature = feature(
name = "contains_objc_source",
flag_sets = [
Expand Down Expand Up @@ -1312,7 +1317,9 @@ def _impl(ctx):
),
],
)
elif (ctx.attr.cpu == "watchos_i386" or ctx.attr.cpu == "watchos_x86_64"):
elif (ctx.attr.cpu == "watchos_i386" or
ctx.attr.cpu == "watchos_x86_64" or
ctx.attr.cpu == "watchos_arm64"):
version_min_feature = feature(
name = "version_min",
flag_sets = [
Expand Down Expand Up @@ -1762,7 +1769,8 @@ def _impl(ctx):
ctx.attr.cpu == "watchos_arm64_32" or
ctx.attr.cpu == "watchos_armv7k" or
ctx.attr.cpu == "watchos_i386" or
ctx.attr.cpu == "watchos_x86_64"):
ctx.attr.cpu == "watchos_x86_64" or
ctx.attr.cpu == "watchos_arm64"):
apply_implicit_frameworks_feature = feature(
name = "apply_implicit_frameworks",
flag_sets = [
Expand Down Expand Up @@ -2846,7 +2854,8 @@ def _impl(ctx):
ctx.attr.cpu == "watchos_arm64_32" or
ctx.attr.cpu == "watchos_armv7k" or
ctx.attr.cpu == "watchos_i386" or
ctx.attr.cpu == "watchos_x86_64"):
ctx.attr.cpu == "watchos_x86_64" or
ctx.attr.cpu == "watchos_arm64"):
features = [
fastbuild_feature,
no_legacy_features_feature,
Expand Down
1 change: 1 addition & 0 deletions tools/osx/crosstool/osx_archs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ OSX_TOOLS_NON_DEVICE_ARCHS = [
"ios_i386",
"ios_x86_64",
"ios_sim_arm64",
"watchos_arm64",
"watchos_i386",
"watchos_x86_64",
"tvos_x86_64",
Expand Down