Skip to content

Commit

Permalink
Add Arm64 support
Browse files Browse the repository at this point in the history
Based on work of Sun Zhiyi <[email protected]>.

Closes #5360.

PiperOrigin-RevId: 201339882
  • Loading branch information
ArielleA authored and Copybara-Service committed Jun 20, 2018
1 parent 7508195 commit 886d01c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/bootstrap/buildenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public String convert(String input) throws OptionsParsingException {
return "ppc";
case ARM:
return "arm";
case AARCH64:
return "aarch64";
case S390X:
return "s390x";
default:
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/google/devtools/build/lib/util/CPU.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
4 changes: 3 additions & 1 deletion tools/cpp/lib_cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
7 changes: 7 additions & 0 deletions tools/platforms/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ constraint_value(
constraint_setting = ":cpu",
)

constraint_value(
name = "aarch64",
constraint_setting = ":cpu",
)

constraint_value(
name = "s390x",
constraint_setting = ":cpu",
Expand Down Expand Up @@ -107,6 +112,7 @@ platform(
":x86_64",
":ppc",
":arm",
":aarch64",
":s390x",
],
host_platform = True,
Expand All @@ -128,6 +134,7 @@ platform(
":x86_64",
":ppc",
":arm",
":aarch64",
":s390x",
],
os_constraints = [
Expand Down
7 changes: 7 additions & 0 deletions tools/platforms/platforms.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ constraint_value(
constraint_setting = ":cpu",
)

constraint_value(
name = "aarch64",
constraint_setting = ":cpu",
)

constraint_value(
name = "s390x",
constraint_setting = ":cpu",
Expand Down Expand Up @@ -95,6 +100,7 @@ platform(
":x86_64",
":ppc",
":arm",
":aarch64",
":s390x",
],
host_platform = True,
Expand All @@ -116,6 +122,7 @@ platform(
":x86_64",
":ppc",
":arm",
":aarch64",
":s390x",
],
os_constraints = [
Expand Down

0 comments on commit 886d01c

Please sign in to comment.