aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/loader/loader.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2022-03-21 15:46:32 -0400
committerCherry Mui <cherryyz@google.com>2022-03-22 19:39:12 +0000
commit77680a064491dd54bd61ef0663276d6f64f66153 (patch)
tree0e16f70db5d624e23de2b9b2d920b09bdbff972c /src/cmd/link/internal/loader/loader.go
parente8534640557939755917edc3e6afc16d93b2e70b (diff)
downloadgo-77680a064491dd54bd61ef0663276d6f64f66153.tar.xz
cmd/link: simplify content hashed symbol handling
Symbol's content hash used to depend on package path expansion in symbol names, so we have special logic handling hashed symbols when path expansion is needed. As we required -p in the compiler the symbol names are now fully expanded. Remove that logic. Change-Id: I888574f63ea3789455d96468a6abd500e0958230 Reviewed-on: https://go-review.googlesource.com/c/go/+/394218 Trust: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/link/internal/loader/loader.go')
-rw-r--r--src/cmd/link/internal/loader/loader.go14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/cmd/link/internal/loader/loader.go b/src/cmd/link/internal/loader/loader.go
index 6f2d41aa78..d46aa41181 100644
--- a/src/cmd/link/internal/loader/loader.go
+++ b/src/cmd/link/internal/loader/loader.go
@@ -261,8 +261,6 @@ type Loader struct {
flags uint32
- hasUnknownPkgPath bool // if any Go object has unknown package path
-
strictDupMsgs int // number of strict-dup warning/errors, when FlagStrictDups is enabled
elfsetstring elfsetstringFunc
@@ -361,7 +359,7 @@ func (l *Loader) addObj(pkg string, r *oReader) Sym {
l.start[r] = i
l.objs = append(l.objs, objIdx{r, i})
if r.NeedNameExpansion() && !r.FromAssembly() {
- l.hasUnknownPkgPath = true
+ panic("object compiled without -p")
}
return i
}
@@ -2126,16 +2124,6 @@ func (st *loadState) preloadSyms(r *oReader, kind int) {
case hashedDef:
start = uint32(r.ndef + r.nhashed64def)
end = uint32(r.ndef + r.nhashed64def + r.nhasheddef)
- if l.hasUnknownPkgPath {
- // The content hash depends on symbol name expansion. If any package is
- // built without fully expanded names, the content hash is unreliable.
- // Treat them as named symbols.
- // This is rare.
- // (We don't need to do this for hashed64Def case, as there the hash
- // function is simply the identity function, which doesn't depend on
- // name expansion.)
- kind = nonPkgDef
- }
case nonPkgDef:
start = uint32(r.ndef + r.nhashed64def + r.nhasheddef)
end = uint32(r.ndef + r.nhashed64def + r.nhasheddef + r.NNonpkgdef())