diff --git a/src/cmd/internal/obj/objfile.go b/src/cmd/internal/obj/objfile.go index a27004a3899..76fbc58f106 100644 --- a/src/cmd/internal/obj/objfile.go +++ b/src/cmd/internal/obj/objfile.go @@ -228,8 +228,7 @@ func (w *objWriter) writeRefs(s *LSym) { } } -func (w *objWriter) writeSymDebug(s *LSym) { - ctxt := w.ctxt +func (ctxt *Link) writeSymDebug(s *LSym) { fmt.Fprintf(ctxt.Bso, "%s ", s.Name) if s.Type != 0 { fmt.Fprintf(ctxt.Bso, "%v ", s.Type) @@ -309,7 +308,7 @@ func (w *objWriter) writeSymDebug(s *LSym) { func (w *objWriter) writeSym(s *LSym) { ctxt := w.ctxt if ctxt.Debugasm > 0 { - w.writeSymDebug(s) + w.ctxt.writeSymDebug(s) } w.wr.WriteByte(symPrefix) diff --git a/src/cmd/internal/obj/objfile2.go b/src/cmd/internal/obj/objfile2.go index 4043e0b9fe9..c51be0265bd 100644 --- a/src/cmd/internal/obj/objfile2.go +++ b/src/cmd/internal/obj/objfile2.go @@ -17,6 +17,10 @@ import ( // Entry point of writing new object file. func WriteObjFile2(ctxt *Link, b *bio.Writer, pkgpath string) { + if ctxt.Debugasm > 0 { + ctxt.traverseSyms(traverseDefs, ctxt.writeSymDebug) + } + genFuncInfoSyms(ctxt) w := writer{