aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/syms.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-01-17 02:38:41 -0800
committerMatthew Dempsky <mdempsky@google.com>2021-01-19 02:41:42 +0000
commit4a4212c0e59dee4458be2f5c85262e54f127c500 (patch)
tree77ec7dd6539ebd89c751fbcc8278812b9e1922e1 /src/cmd/compile/internal/typecheck/syms.go
parent4f5c603c0f4375d7612feedfd4d5bef41a4060ee (diff)
downloadgo-4a4212c0e59dee4458be2f5c85262e54f127c500.tar.gz
go-4a4212c0e59dee4458be2f5c85262e54f127c500.zip
[dev.regabi] cmd/compile: refactor Linksym creation
Currently there's a lot of logic within package types for creating Linksyms. This CL pulls it out into base, where it can be more easily reused by other compiler code that shouldn't need to depend on package types. Package base probably isn't the best place for this, but it's convenient because it's a package that types already depends on. It's also where the Ctxt object lives, which these functions depend upon. Passes toolstash -cmp w/ -gcflags=all=-abiwrap. Change-Id: I50d8b7e4596955205036969eab24d7dab053b363 Reviewed-on: https://go-review.googlesource.com/c/go/+/284231 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Trust: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/syms.go')
-rw-r--r--src/cmd/compile/internal/typecheck/syms.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/cmd/compile/internal/typecheck/syms.go b/src/cmd/compile/internal/typecheck/syms.go
index f6ff2ee5da..202a932e6c 100644
--- a/src/cmd/compile/internal/typecheck/syms.go
+++ b/src/cmd/compile/internal/typecheck/syms.go
@@ -86,14 +86,17 @@ func InitRuntime() {
// LookupRuntimeFunc looks up Go function name in package runtime. This function
// must follow the internal calling convention.
func LookupRuntimeFunc(name string) *obj.LSym {
- s := ir.Pkgs.Runtime.Lookup(name)
- s.SetFunc(true)
- return s.Linksym()
+ return LookupRuntimeABI(name, obj.ABIInternal)
}
// LookupRuntimeVar looks up a variable (or assembly function) name in package
// runtime. If this is a function, it may have a special calling
// convention.
func LookupRuntimeVar(name string) *obj.LSym {
- return ir.Pkgs.Runtime.Lookup(name).Linksym()
+ return LookupRuntimeABI(name, obj.ABI0)
+}
+
+// LookupRuntimeABI looks up a name in package runtime using the given ABI.
+func LookupRuntimeABI(name string, abi obj.ABI) *obj.LSym {
+ return base.PkgLinksym("runtime", name, abi)
}