Only tests do this, provide them a hook to disable freeing
after flush.
Change-Id: I810c6c51414a93f476a18ba07b807e16092bf8cf
Reviewed-on: https://go-review.googlesource.com/19907
Reviewed-by: Keith Randall <khr@golang.org>
                t.Errorf(format, args...)
                ok = false
        }
-       obj.Flushplist(ctxt)
+       obj.FlushplistNoFree(ctxt)
 
        for p := top; p != nil; p = p.Link {
                if p.As == obj.ATEXT {
 
 }
 
 func Flushplist(ctxt *Link) {
+       flushplist(ctxt, true)
+}
+func FlushplistNoFree(ctxt *Link) {
+       flushplist(ctxt, false)
+}
+func flushplist(ctxt *Link, freeProgs bool) {
        var flag int
        var s *LSym
        var p *Prog
        ctxt.Plist = nil
        ctxt.Plast = nil
        ctxt.Curp = nil
-       ctxt.freeProgs()
+       if freeProgs {
+               ctxt.freeProgs()
+       }
 }
 
 func Writeobjfile(ctxt *Link, b *Biobuf) {