aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Arielle Albon <arielle@hopeless-newbie.co.uk>2018-06-20 05:51:18 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-20 05:53:02 -0700
commit886d01c89fca32e46f5841081eb3288e5b4f313b (patch)
tree99d3601c166bc492637542cab9babe8b495af730
parent7508195014ccbe63069fa9b51835ce26019df8ee (diff)
Add Arm64 support
Based on work of Sun Zhiyi <zhiyisun@gmail.com>. Closes #5360. PiperOrigin-RevId: 201339882
-rwxr-xr-xscripts/bootstrap/buildenv.sh2
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/util/CPU.java3
-rw-r--r--tools/cpp/lib_cc_configure.bzl4
-rw-r--r--tools/platforms/BUILD7
-rw-r--r--tools/platforms/platforms.BUILD7
6 files changed, 22 insertions, 3 deletions
diff --git a/scripts/bootstrap/buildenv.sh b/scripts/bootstrap/buildenv.sh
index 0689b95919..0c7e8d443f 100755
--- a/scripts/bootstrap/buildenv.sh
+++ b/scripts/bootstrap/buildenv.sh
@@ -53,7 +53,7 @@ PLATFORM="$(uname -s | tr 'A-Z' 'a-z')"
MACHINE_TYPE="$(uname -m)"
MACHINE_IS_64BIT='no'
-if [ "${MACHINE_TYPE}" = 'amd64' -o "${MACHINE_TYPE}" = 'x86_64' -o "${MACHINE_TYPE}" = 's390x' ]; then
+if [ "${MACHINE_TYPE}" = 'amd64' -o "${MACHINE_TYPE}" = 'x86_64' -o "${MACHINE_TYPE}" = 's390x' -o "${MACHINE_TYPE}" = 'aarch64' ]; then
MACHINE_IS_64BIT='yes'
fi
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java b/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java
index d63ffdd630..32d25c8309 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java
@@ -55,6 +55,8 @@ public class AutoCpuConverter implements Converter<String> {
return "ppc";
case ARM:
return "arm";
+ case AARCH64:
+ return "aarch64";
case S390X:
return "s390x";
default:
diff --git a/src/main/java/com/google/devtools/build/lib/util/CPU.java b/src/main/java/com/google/devtools/build/lib/util/CPU.java
index e210eb5c43..a3f7308ad6 100644
--- a/src/main/java/com/google/devtools/build/lib/util/CPU.java
+++ b/src/main/java/com/google/devtools/build/lib/util/CPU.java
@@ -24,7 +24,8 @@ public enum CPU {
X86_32("x86_32", ImmutableSet.of("i386", "i486", "i586", "i686", "i786", "x86")),
X86_64("x86_64", ImmutableSet.of("amd64", "x86_64", "x64")),
PPC("ppc", ImmutableSet.of("ppc", "ppc64", "ppc64le")),
- ARM("arm", ImmutableSet.of("aarch64", "arm", "armv7l")),
+ ARM("arm", ImmutableSet.of("arm", "armv7l")),
+ AARCH64("aarch64", ImmutableSet.of("aarch64")),
S390X("s390x", ImmutableSet.of("s390x", "s390")),
UNKNOWN("unknown", ImmutableSet.<String>of());
diff --git a/tools/cpp/lib_cc_configure.bzl b/tools/cpp/lib_cc_configure.bzl
index d7a46a3428..ebb0a05e50 100644
--- a/tools/cpp/lib_cc_configure.bzl
+++ b/tools/cpp/lib_cc_configure.bzl
@@ -188,8 +188,10 @@ def get_cpu_value(repository_ctx):
result = repository_ctx.execute(["uname", "-m"])
if result.stdout.strip() in ["power", "ppc64le", "ppc", "ppc64"]:
return "ppc"
- if result.stdout.strip() in ["arm", "armv7l", "aarch64"]:
+ if result.stdout.strip() in ["arm", "armv7l"]:
return "arm"
+ if result.stdout.strip() in ["aarch64"]:
+ return "aarch64"
return "k8" if result.stdout.strip() in ["amd64", "x86_64", "x64"] else "piii"
def is_cc_configure_debug(repository_ctx):
diff --git a/tools/platforms/BUILD b/tools/platforms/BUILD
index 4323b33544..960c013290 100644
--- a/tools/platforms/BUILD
+++ b/tools/platforms/BUILD
@@ -40,6 +40,11 @@ constraint_value(
)
constraint_value(
+ name = "aarch64",
+ constraint_setting = ":cpu",
+)
+
+constraint_value(
name = "s390x",
constraint_setting = ":cpu",
)
@@ -107,6 +112,7 @@ platform(
":x86_64",
":ppc",
":arm",
+ ":aarch64",
":s390x",
],
host_platform = True,
@@ -128,6 +134,7 @@ platform(
":x86_64",
":ppc",
":arm",
+ ":aarch64",
":s390x",
],
os_constraints = [
diff --git a/tools/platforms/platforms.BUILD b/tools/platforms/platforms.BUILD
index 5ff4ba804b..775bea748d 100644
--- a/tools/platforms/platforms.BUILD
+++ b/tools/platforms/platforms.BUILD
@@ -28,6 +28,11 @@ constraint_value(
)
constraint_value(
+ name = "aarch64",
+ constraint_setting = ":cpu",
+)
+
+constraint_value(
name = "s390x",
constraint_setting = ":cpu",
)
@@ -95,6 +100,7 @@ platform(
":x86_64",
":ppc",
":arm",
+ ":aarch64",
":s390x",
],
host_platform = True,
@@ -116,6 +122,7 @@ platform(
":x86_64",
":ppc",
":arm",
+ ":aarch64",
":s390x",
],
os_constraints = [