aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2022-04-27 09:03:35 -0400
committerRuss Cox <rsc@golang.org>2022-04-29 14:23:19 +0000
commite5407501cb5c43f9ba874fe5dad215435acbf5a2 (patch)
tree656e8f9892a61d65a75c05b933570de49c2b5a4a /src/cmd/internal/obj
parentfe006d641079e8943833573bd1275ef51eb7fb60 (diff)
downloadgo-e5407501cb5c43f9ba874fe5dad215435acbf5a2.tar.xz
[dev.boringcrypto] cmd: use notsha256 instead of md5, sha1, sha256
When we add GOEXPERIMENT=boringcrypto, the bootstrap process will not converge if the compiler itself depends on the boringcrypto cgo-based implementations of sha1 and sha256. Using notsha256 avoids boringcrypto and makes bootstrap converge. Removing md5 is not strictly necessary but it seemed worthwhile to be consistent. For #51940. Change-Id: Iba649507e0964d1a49a1d16e463dd23c4e348f14 Reviewed-on: https://go-review.googlesource.com/c/go/+/402595 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/internal/obj')
-rw-r--r--src/cmd/internal/obj/objfile.go4
-rw-r--r--src/cmd/internal/obj/sym.go4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/internal/obj/objfile.go b/src/cmd/internal/obj/objfile.go
index 2f7ce061d4..2caff62702 100644
--- a/src/cmd/internal/obj/objfile.go
+++ b/src/cmd/internal/obj/objfile.go
@@ -10,9 +10,9 @@ import (
"bytes"
"cmd/internal/bio"
"cmd/internal/goobj"
+ "cmd/internal/notsha256"
"cmd/internal/objabi"
"cmd/internal/sys"
- "crypto/sha1"
"encoding/binary"
"fmt"
"io"
@@ -460,7 +460,7 @@ func contentHash64(s *LSym) goobj.Hash64Type {
// For now, we assume there is no circular dependencies among
// hashed symbols.
func (w *writer) contentHash(s *LSym) goobj.HashType {
- h := sha1.New()
+ h := notsha256.New()
var tmp [14]byte
// Include the size of the symbol in the hash.
diff --git a/src/cmd/internal/obj/sym.go b/src/cmd/internal/obj/sym.go
index a8360527ef..95dd07d0fa 100644
--- a/src/cmd/internal/obj/sym.go
+++ b/src/cmd/internal/obj/sym.go
@@ -33,8 +33,8 @@ package obj
import (
"cmd/internal/goobj"
+ "cmd/internal/notsha256"
"cmd/internal/objabi"
- "crypto/md5"
"fmt"
"internal/buildcfg"
"log"
@@ -175,7 +175,7 @@ func (ctxt *Link) Int64Sym(i int64) *LSym {
// GCLocalsSym generates a content-addressable sym containing data.
func (ctxt *Link) GCLocalsSym(data []byte) *LSym {
- return ctxt.LookupInit(fmt.Sprintf("gclocals·%x", md5.Sum(data)), func(lsym *LSym) {
+ return ctxt.LookupInit(fmt.Sprintf("gclocals·%x", notsha256.Sum256(data)), func(lsym *LSym) {
lsym.P = data
lsym.Set(AttrContentAddressable, true)
})