Skip to content

Commit

Permalink
[build] Fix RNG flags to permit aarch64 bazel test ...
Browse files Browse the repository at this point in the history
Towards #286
Workaround for abseil/abseil-cpp#662

PiperOrigin-RevId: 357990845
  • Loading branch information
cdleary authored and Copybara-Service committed Feb 17, 2021
1 parent aa530c4 commit 8a29c2f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dependency_support/com_google_absl/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2021 The XLS Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Needed to make this a package.
50 changes: 50 additions & 0 deletions dependency_support/com_google_absl/aarch64_rng_flags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2021 The XLS Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

--- absl/copts/configure_copts.bzl
+++ absl/copts/configure_copts.bzl
@@ -45,16 +45,17 @@
ABSL_RANDOM_RANDEN_COPTS = select({
# APPLE
":cpu_darwin_x86_64": ABSL_RANDOM_HWAES_X64_FLAGS,
":cpu_darwin": ABSL_RANDOM_HWAES_X64_FLAGS,
":cpu_x64_windows_msvc": ABSL_RANDOM_HWAES_MSVC_X64_FLAGS,
":cpu_x64_windows": ABSL_RANDOM_HWAES_MSVC_X64_FLAGS,
":cpu_k8": ABSL_RANDOM_HWAES_X64_FLAGS,
":cpu_ppc": ["-mcrypto"],
+ ":cpu_aarch64": ABSL_RANDOM_HWAES_ARM64_FLAGS,

# Supported by default or unsupported.
"//conditions:default": [],
})

# absl_random_randen_copts_init:
# Initialize the config targets based on cpu, os, etc. used to select
# the required values for ABSL_RANDOM_RANDEN_COPTS
@@ -65,14 +66,15 @@
# These configs have consistent flags to enable HWAES intsructions.
cpu_configs = [
"ppc",
"k8",
"darwin_x86_64",
"darwin",
"x64_windows_msvc",
"x64_windows",
+ "aarch64",
]
for cpu in cpu_configs:
native.config_setting(
name = "cpu_%s" % cpu,
values = {"cpu": cpu},
)
1 change: 1 addition & 0 deletions dependency_support/load_external.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def load_external_repositories():
strip_prefix = "abseil-cpp-3c8b5d7587dc8ecf730ce9996c89e156e408c3ed",
urls = ["https://github.com/abseil/abseil-cpp/archive/3c8b5d7587dc8ecf730ce9996c89e156e408c3ed.zip"],
sha256 = "2adc8d02700923164a1128afd36d245ac6fd9fe4a10ee936146b89cd9e4b82a5",
patches = ["//dependency_support/com_google_absl:aarch64_rng_flags.patch"],
)

# Protobuf depends on Skylib
Expand Down

0 comments on commit 8a29c2f

Please sign in to comment.