aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2023-08-26 19:06:33 -0700
committerGopher Robot <gobot@golang.org>2023-08-29 07:48:38 +0000
commiteaae2d45c76d2d27e1b4c39ba57dd1582ab26491 (patch)
tree956a7ba7e6a51bf3dad503d1f1b5eacf8763388f /src/cmd/internal
parentf7f1c4f86d72bac49cfd30fc94ec62756d951245 (diff)
downloadgo-eaae2d45c76d2d27e1b4c39ba57dd1582ab26491.tar.xz
cmd: simplify some handling of package paths
We have obj.Link.Pkgpath, so we don't need to pass it redundantly in places where we already have an *obj.Link. Also, renaming the parser's "compilingRuntime" field to "allowABI", to match the "AllowAsmABI" name used by objabi.LookupPkgSpecial. Finally, push the handling of GOEXPERIMENT_* flags up to cmd/asm's main entry point, by simply appending them to flags.D. Change-Id: I6ada134522b0cbc90d35bcb145fbe045338fefb7 Reviewed-on: https://go-review.googlesource.com/c/go/+/523297 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/internal')
-rw-r--r--src/cmd/internal/dwarf/dwarf.go1
-rw-r--r--src/cmd/internal/obj/dwarf.go17
-rw-r--r--src/cmd/internal/obj/plist.go6
3 files changed, 14 insertions, 10 deletions
diff --git a/src/cmd/internal/dwarf/dwarf.go b/src/cmd/internal/dwarf/dwarf.go
index d4a4e33652..90dff02b68 100644
--- a/src/cmd/internal/dwarf/dwarf.go
+++ b/src/cmd/internal/dwarf/dwarf.go
@@ -1233,7 +1233,6 @@ func putPrunedScopes(ctxt Context, s *FnState, fnabbrev int) error {
// DIE (as a space-saving measure, so that name/type etc doesn't have
// to be repeated for each inlined copy).
func PutAbstractFunc(ctxt Context, s *FnState) error {
-
if logDwarf {
ctxt.Logf("PutAbstractFunc(%v)\n", s.Absfn)
}
diff --git a/src/cmd/internal/obj/dwarf.go b/src/cmd/internal/obj/dwarf.go
index f1330c9258..f5578f341f 100644
--- a/src/cmd/internal/obj/dwarf.go
+++ b/src/cmd/internal/obj/dwarf.go
@@ -345,7 +345,12 @@ func (ctxt *Link) fileSymbol(fn *LSym) *LSym {
// populateDWARF fills in the DWARF Debugging Information Entries for
// TEXT symbol 's'. The various DWARF symbols must already have been
// initialized in InitTextSym.
-func (ctxt *Link) populateDWARF(curfn interface{}, s *LSym, myimportpath string) {
+func (ctxt *Link) populateDWARF(curfn interface{}, s *LSym) {
+ myimportpath := ctxt.Pkgpath
+ if myimportpath == "" {
+ return
+ }
+
info, loc, ranges, absfunc, lines := ctxt.dwarfSym(s)
if info.Size != 0 {
ctxt.Diag("makeFuncDebugEntry double process %v", s)
@@ -394,7 +399,8 @@ func (ctxt *Link) populateDWARF(curfn interface{}, s *LSym, myimportpath string)
// DwarfIntConst creates a link symbol for an integer constant with the
// given name, type and value.
-func (ctxt *Link) DwarfIntConst(myimportpath, name, typename string, val int64) {
+func (ctxt *Link) DwarfIntConst(name, typename string, val int64) {
+ myimportpath := ctxt.Pkgpath
if myimportpath == "" {
return
}
@@ -407,7 +413,8 @@ func (ctxt *Link) DwarfIntConst(myimportpath, name, typename string, val int64)
// DwarfGlobal creates a link symbol containing a DWARF entry for
// a global variable.
-func (ctxt *Link) DwarfGlobal(myimportpath, typename string, varSym *LSym) {
+func (ctxt *Link) DwarfGlobal(typename string, varSym *LSym) {
+ myimportpath := ctxt.Pkgpath
if myimportpath == "" || varSym.Local() {
return
}
@@ -421,7 +428,7 @@ func (ctxt *Link) DwarfGlobal(myimportpath, typename string, varSym *LSym) {
dwarf.PutGlobal(dwCtxt{ctxt}, dieSym, typeSym, varSym, varname)
}
-func (ctxt *Link) DwarfAbstractFunc(curfn interface{}, s *LSym, myimportpath string) {
+func (ctxt *Link) DwarfAbstractFunc(curfn interface{}, s *LSym) {
absfn := ctxt.DwFixups.AbsFuncDwarfSym(s)
if absfn.Size != 0 {
ctxt.Diag("internal error: DwarfAbstractFunc double process %v", s)
@@ -434,7 +441,7 @@ func (ctxt *Link) DwarfAbstractFunc(curfn interface{}, s *LSym, myimportpath str
dwctxt := dwCtxt{ctxt}
fnstate := dwarf.FnState{
Name: s.Name,
- Importpath: myimportpath,
+ Importpath: ctxt.Pkgpath,
Info: absfn,
Absfn: absfn,
StartLine: startLine,
diff --git a/src/cmd/internal/obj/plist.go b/src/cmd/internal/obj/plist.go
index 921dfee2a3..9cdf0800f0 100644
--- a/src/cmd/internal/obj/plist.go
+++ b/src/cmd/internal/obj/plist.go
@@ -21,7 +21,7 @@ type Plist struct {
// It is used to provide access to cached/bulk-allocated Progs to the assemblers.
type ProgAlloc func() *Prog
-func Flushplist(ctxt *Link, plist *Plist, newprog ProgAlloc, myimportpath string) {
+func Flushplist(ctxt *Link, plist *Plist, newprog ProgAlloc) {
// Build list of symbols, and assign instructions to lists.
var curtext *LSym
var etext *Prog
@@ -155,9 +155,7 @@ func Flushplist(ctxt *Link, plist *Plist, newprog ProgAlloc, myimportpath string
continue
}
linkpcln(ctxt, s)
- if myimportpath != "" {
- ctxt.populateDWARF(plist.Curfn, s, myimportpath)
- }
+ ctxt.populateDWARF(plist.Curfn, s)
if ctxt.Headtype == objabi.Hwindows && ctxt.Arch.SEH != nil {
s.Func().sehUnwindInfoSym = ctxt.Arch.SEH(ctxt, s)
}