diff options
| author | Cherry Zhang <cherryyz@google.com> | 2019-10-08 21:43:20 -0400 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2019-10-10 22:05:21 +0000 |
| commit | ffca64dcf35e6298d25c87f3ab42c182c355c268 (patch) | |
| tree | 0692066dd10053c7af22c6b14fc1447d076002d9 /src/cmd/internal/obj | |
| parent | 8a9be4921a3cc91c80c02bb5b4cf2ad129c0c7cc (diff) | |
| download | go-ffca64dcf35e6298d25c87f3ab42c182c355c268.tar.xz | |
[dev.link] cmd/internal/obj: support -S flag in newobj mode
When the compiler's -S flag is specified, it dumps the
disassembly. Add this when writing the new style object file.
Change-Id: I4cf85e57d22d0ceea1fda6d3b59fe363573659e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/200100
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/internal/obj')
| -rw-r--r-- | src/cmd/internal/obj/objfile.go | 5 | ||||
| -rw-r--r-- | src/cmd/internal/obj/objfile2.go | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/cmd/internal/obj/objfile.go b/src/cmd/internal/obj/objfile.go index a27004a389..76fbc58f10 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 4043e0b9fe..c51be0265b 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{ |
