diff options
author | Russ Cox <rsc@golang.org> | 2020-12-21 01:36:15 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2020-12-21 19:23:30 +0000 |
commit | 4836e28ac0482183a3a6af88ee4295ffdbc94f62 (patch) | |
tree | e979010cc2cf17aac1d5d17bdb9043919fa9422a /src/cmd/compile/internal/gc/main.go | |
parent | 85ce6ecfe3c54075c7bc53538940f0319b57068b (diff) | |
download | go-4836e28ac0482183a3a6af88ee4295ffdbc94f62.tar.gz go-4836e28ac0482183a3a6af88ee4295ffdbc94f62.zip |
[dev.regabi] cmd/compile: separate noder more cleanly
Separate embed, cgo pragmas, and Main trackScopes variable
from noder more cleanly.
This lets us split embed and noder into new packages.
It also assumes that the local embedded variables will be
removed and deletes them now for simplicity.
Change-Id: I9638bcc2c5f0e76440de056c6285b6aa2f73a00d
Reviewed-on: https://go-review.googlesource.com/c/go/+/279299
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/gc/main.go')
-rw-r--r-- | src/cmd/compile/internal/gc/main.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index 545491daa1..45880c5cde 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -205,8 +205,6 @@ func Main(archInit func(*Arch)) { } } - trackScopes = base.Flag.Dwarf - Widthptr = thearch.LinkArch.PtrSize Widthreg = thearch.LinkArch.RegSize @@ -226,6 +224,7 @@ func Main(archInit func(*Arch)) { timings.Start("fe", "parse") lines := parseFiles(flag.Args()) + cgoSymABIs() timings.Stop() timings.AddEvent(int64(lines), "lines") @@ -477,6 +476,20 @@ func Main(archInit func(*Arch)) { } } +func cgoSymABIs() { + // The linker expects an ABI0 wrapper for all cgo-exported + // functions. + for _, prag := range Target.CgoPragmas { + switch prag[0] { + case "cgo_export_static", "cgo_export_dynamic": + if symabiRefs == nil { + symabiRefs = make(map[string]obj.ABI) + } + symabiRefs[prag[1]] = obj.ABI0 + } + } +} + // numNonClosures returns the number of functions in list which are not closures. func numNonClosures(list []*ir.Func) int { count := 0 |