mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-02-13 06:25:06 -05:00
**What type of PR is this?** Bug fix **What does this PR do? Why is it needed?** It appears that #16216 introduced hashtree integration but broke builds on macOS Intel (darwin_amd64). ``` Error: Undefined symbols for architecture x86_64: "_github.com/OffchainLabs/hashtree.HashtreeHash" ``` The Bazel patch for hashtree was missing `wrapper_darwin_amd64.s`. So, `//go:noescape` in `bindings.go` assumes that symbols are available elsewhere, and while on other platforms optimized version is used, on Darwin we have stub (symbol still must be available), which needs to be referenced -- hence, this PR. **Other notes for review** I've re-checked using `bazel clean && bazel build //cmd/beacon-chain` -- it was failing before, works now. cc @potuz as original patch author **Acknowledgements** - [x] I have read [CONTRIBUTING.md](https://github.com/prysmaticlabs/prysm/blob/develop/CONTRIBUTING.md). - [x] I have included a uniquely named [changelog fragment file](https://github.com/prysmaticlabs/prysm/blob/develop/CONTRIBUTING.md#maintaining-changelogmd). - [x] I have added a description with sufficient context for reviewers to understand this PR. - [x] I have tested that my changes work as expected and I added a testing plan to the PR description (if applicable). Co-authored-by: Potuz <potuz@prysmaticlabs.com>
95 lines
2.8 KiB
Diff
95 lines
2.8 KiB
Diff
diff -urN a/BUILD.bazel b/BUILD.bazel
|
|
--- a/BUILD.bazel 1969-12-31 18:00:00.000000000 -0600
|
|
+++ b/BUILD.bazel 2025-01-05 12:00:00.000000000 -0600
|
|
@@ -0,0 +1,90 @@
|
|
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
|
+
|
|
+go_library(
|
|
+ name = "go_default_library",
|
|
+ srcs = [
|
|
+ "bindings.go",
|
|
+ "sha256_1_generic.go",
|
|
+ ] + select({
|
|
+ "@io_bazel_rules_go//go/platform:linux_amd64": [
|
|
+ "bindings_amd64.go",
|
|
+ "wrapper_linux_amd64.s",
|
|
+ ":hashtree_amd64_syso",
|
|
+ ],
|
|
+ "@io_bazel_rules_go//go/platform:windows_amd64": [
|
|
+ "bindings_amd64.go",
|
|
+ "wrapper_windows_amd64.s",
|
|
+ ":hashtree_amd64_syso",
|
|
+ ],
|
|
+ "@io_bazel_rules_go//go/platform:linux_arm64": [
|
|
+ "bindings_arm64.go",
|
|
+ "wrapper_arm64.s",
|
|
+ ":hashtree_arm64_syso",
|
|
+ ],
|
|
+ "@io_bazel_rules_go//go/platform:darwin_arm64": [
|
|
+ "bindings_arm64.go",
|
|
+ "wrapper_arm64.s",
|
|
+ ":hashtree_arm64_syso",
|
|
+ ],
|
|
+ "@io_bazel_rules_go//go/platform:darwin_amd64": [
|
|
+ "bindings_darwin_amd64.go",
|
|
+ "wrapper_darwin_amd64.s",
|
|
+ ],
|
|
+ "//conditions:default": [],
|
|
+ }),
|
|
+ importpath = "github.com/OffchainLabs/hashtree",
|
|
+ visibility = ["//visibility:public"],
|
|
+ deps = ["@com_github_klauspost_cpuid_v2//:go_default_library"],
|
|
+)
|
|
+
|
|
+genrule(
|
|
+ name = "hashtree_arm64_syso",
|
|
+ srcs = [":hashtree_arm64"],
|
|
+ outs = ["hashtree_arm64.syso"],
|
|
+ cmd = "cp $$(echo $(locations :hashtree_arm64) | tr ' ' '\\n' | grep -v '\\.pic\\.' | head -1) $@",
|
|
+)
|
|
+
|
|
+genrule(
|
|
+ name = "hashtree_amd64_syso",
|
|
+ srcs = [":hashtree_amd64"],
|
|
+ outs = ["hashtree_amd64.syso"],
|
|
+ cmd = "cp $$(echo $(locations :hashtree_amd64) | tr ' ' '\\n' | grep -v '\\.pic\\.' | head -1) $@",
|
|
+)
|
|
+
|
|
+cc_library(
|
|
+ name = "hashtree_arm64",
|
|
+ srcs = [
|
|
+ "src/hashtree.c",
|
|
+ "src/sha256_generic.c",
|
|
+ "src/sha256_armv8_crypto.S",
|
|
+ "src/sha256_armv8_neon_x1.S",
|
|
+ "src/sha256_armv8_neon_x4.S",
|
|
+ ],
|
|
+ hdrs = ["src/hashtree.h"],
|
|
+ copts = ["-O3", "-Wall"],
|
|
+ linkstatic = True,
|
|
+ strip_include_prefix = "src",
|
|
+ visibility = ["//visibility:public"],
|
|
+)
|
|
+
|
|
+cc_library(
|
|
+ name = "hashtree_amd64",
|
|
+ srcs = [
|
|
+ "src/hashtree.c",
|
|
+ "src/sha256_generic.c",
|
|
+ "src/sha256_avx_x1.S",
|
|
+ "src/sha256_avx_x4.S",
|
|
+ "src/sha256_avx_x8.S",
|
|
+ "src/sha256_avx_x16.S",
|
|
+ "src/sha256_shani.S",
|
|
+ "src/sha256_sse_x1.S",
|
|
+ ],
|
|
+ hdrs = ["src/hashtree.h"],
|
|
+ copts = ["-O3", "-Wall"] + select({
|
|
+ "@platforms//os:windows": [],
|
|
+ "//conditions:default": ["-fno-integrated-as"],
|
|
+ }),
|
|
+ linkstatic = True,
|
|
+ strip_include_prefix = "src",
|
|
+ visibility = ["//visibility:public"],
|
|
+)
|