From be231c1dacb42754fdabeb4d56f7dcdab1ff4e0a Mon Sep 17 00:00:00 2001 From: Arielle Albon Date: Wed, 26 Sep 2018 18:28:45 +0200 Subject: [PATCH] Arm64 support on Linux (#1550) Fixes #1506 --- go/platform/list.bzl | 2 +- go/private/sdk.bzl | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/go/platform/list.bzl b/go/platform/list.bzl index 245261fa65..0cbfc2ccb8 100644 --- a/go/platform/list.bzl +++ b/go/platform/list.bzl @@ -31,7 +31,7 @@ GOARCH = { "amd64": "@bazel_tools//platforms:x86_64", "amd64p32": None, "arm": "@bazel_tools//platforms:arm", - "arm64": None, + "arm64": "@bazel_tools//platforms:aarch64", "mips": None, "mips64": None, "mips64le": None, diff --git a/go/private/sdk.bzl b/go/private/sdk.bzl index 729c5ec315..d155e0bfc8 100644 --- a/go/private/sdk.bzl +++ b/go/private/sdk.bzl @@ -138,6 +138,16 @@ def _detect_host_platform(ctx): host = "linux_ppc64le" elif uname == "i686": host = "linux_386" + # uname -p is not working on Aarch64 boards + res = ctx.execute(["uname", "-m"]) + if res.return_code == 0: + uname = res.stdout.strip() + if uname == "aarch64": + host = "linux_arm64" + elif uname == "armv6l": + host = "linux_armv6l" + elif uname == "armv7l": + host = "linux_armv6l" # Default to amd64 when uname doesn't return a known value.