diff options
author | Matthew Dempsky <mdempsky@google.com> | 2020-12-28 19:14:39 -0800 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2020-12-29 07:54:40 +0000 |
commit | 25c613c02dabb45f3a3dc038a8f01c664d98731a (patch) | |
tree | 9a40e67713e82378a5cecad7e01e287e4c362b57 /src/cmd/compile/internal/types/sym.go | |
parent | 289da2b33ed6292c853017a15d3108d22ea7491a (diff) | |
download | go-25c613c02dabb45f3a3dc038a8f01c664d98731a.tar.gz go-25c613c02dabb45f3a3dc038a8f01c664d98731a.zip |
[dev.regabi] cmd/compile: add Linksym helpers
Syms are meant to be just interned (pkg, name) tuples, and are a
purely abstract, Go-language concept. As such, associating them with
linker symbols (a low-level, implementation-oriented detail) is
inappropriate.
There's still work to be done before linker symbols can be directly
attached to their appropriate, higher-level objects instead. But in
the mean-time, we can at least add helper functions and discourage
folks from using Sym.Linksym directly. The next CL will mechanically
rewrite code to use these helpers where possible.
Passes toolstash -cmp.
Change-Id: I413bd1c80bce056304f9a7343526bd153f2b9c7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/280639
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/types/sym.go')
-rw-r--r-- | src/cmd/compile/internal/types/sym.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types/sym.go b/src/cmd/compile/internal/types/sym.go index cd061d5f1c..2914e2ed3f 100644 --- a/src/cmd/compile/internal/types/sym.go +++ b/src/cmd/compile/internal/types/sym.go @@ -74,6 +74,10 @@ func (sym *Sym) LinksymName() string { return sym.Pkg.Prefix + "." + sym.Name } +// Deprecated: This method should not be used directly. Instead, use a +// higher-level abstraction that directly returns the linker symbol +// for a named object. For example, reflectdata.TypeLinksym(t) instead +// of reflectdata.TypeSym(t).Linksym(). func (sym *Sym) Linksym() *obj.LSym { if sym == nil { return nil |