1

Use -mcpu=apple_m1 when targeting macos + aarch64

This commit is contained in:
Jeremy Volkman 2022-12-17 10:26:04 -08:00 committed by Motiejus Jakštys
parent cba7c5fcae
commit 6ee01496be

View File

@ -48,6 +48,11 @@ def target_structs():
def _target_macos(gocpu, zigcpu): def _target_macos(gocpu, zigcpu):
min_os = "11" min_os = "11"
copts = []
if zigcpu == "aarch64":
copts = ["-mcpu=apple_m1"]
return struct( return struct(
gotarget = "darwin_{}".format(gocpu), gotarget = "darwin_{}".format(gocpu),
zigtarget = "{}-macos-none".format(zigcpu), zigtarget = "{}-macos-none".format(zigcpu),
@ -59,7 +64,7 @@ def _target_macos(gocpu, zigcpu):
"libc/include/any-macos-any", "libc/include/any-macos-any",
] + _INCLUDE_TAIL, ] + _INCLUDE_TAIL,
dynamic_library_linkopts = ["-Wl,-undefined=dynamic_lookup"], dynamic_library_linkopts = ["-Wl,-undefined=dynamic_lookup"],
copts = [], copts = copts,
libc = "darwin", libc = "darwin",
bazel_target_cpu = "darwin", bazel_target_cpu = "darwin",
constraint_values = [ constraint_values = [