aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/staticdata/data.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-01-12 11:34:00 -0800
committerMatthew Dempsky <mdempsky@google.com>2021-01-12 23:21:58 +0000
commitcd5b74d2dfe6009d55c86e90f6c204e58c229c16 (patch)
tree1ff0a5bd58acb66cad30cc8314acdac4e0e61601 /src/cmd/compile/internal/staticdata/data.go
parent95acd8121bf76a15ecba0259367dca0efe6d3a77 (diff)
downloadgo-cd5b74d2dfe6009d55c86e90f6c204e58c229c16.tar.xz
[dev.regabi] cmd/compile: call NeedFuncSym in InitLSym
InitLSym is where we're now generating ABI wrappers, so it seems as good a place as any to make sure we're generating the degenerate closure wrappers for declared functions and methods. Change-Id: I097f34bbcee65dee87a97f9ed6f3f38e4cf2e2b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/283312 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/staticdata/data.go')
-rw-r--r--src/cmd/compile/internal/staticdata/data.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/staticdata/data.go b/src/cmd/compile/internal/staticdata/data.go
index a2a844f940..4b12590fde 100644
--- a/src/cmd/compile/internal/staticdata/data.go
+++ b/src/cmd/compile/internal/staticdata/data.go
@@ -265,7 +265,7 @@ func FuncLinksym(n *ir.Name) *obj.LSym {
return FuncSym(n.Sym()).Linksym()
}
-// NeedFuncSym ensures that s·f is exported.
+// NeedFuncSym ensures that s·f is exported, if needed.
// It is only used with -dynlink.
// When not compiling for dynamic linking,
// the funcsyms are created as needed by
@@ -275,8 +275,13 @@ func FuncLinksym(n *ir.Name) *obj.LSym {
// So instead, when dynamic linking, we only create
// the s·f stubs in s's package.
func NeedFuncSym(s *types.Sym) {
+ if base.Ctxt.InParallel {
+ // The append below probably just needs to lock
+ // funcsymsmu, like in FuncSym.
+ base.Fatalf("NeedFuncSym must be called in serial")
+ }
if !base.Ctxt.Flag_dynlink {
- base.Fatalf("NeedFuncSym: dynlink")
+ return
}
if s.IsBlank() {
return
@@ -287,9 +292,7 @@ func NeedFuncSym(s *types.Sym) {
// get funcsyms.
return
}
- if _, existed := s.Pkg.LookupOK(ir.FuncSymName(s)); !existed {
- funcsyms = append(funcsyms, s)
- }
+ funcsyms = append(funcsyms, s)
}
func WriteFuncSyms() {