Commit ffca64dc authored by Cherry Zhang's avatar Cherry Zhang

[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: default avatarThan McIntosh <thanm@google.com>
parent 8a9be492
......@@ -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)
......
......@@ -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{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment