]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: remove -a flag
authorCherry Zhang <cherryyz@google.com>
Fri, 24 Apr 2020 03:30:15 +0000 (23:30 -0400)
committerCherry Zhang <cherryyz@google.com>
Fri, 24 Apr 2020 14:50:46 +0000 (14:50 +0000)
It doesn't do what it says. It has been like that since Go 1.4.
The current ouput is pretty useless. Remove it.

Change-Id: Id9b4ba04139aaf7ea59acbd51428b1c992115389
Reviewed-on: https://go-review.googlesource.com/c/go/+/229859
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/main.go
src/cmd/link/internal/ld/xcoff.go

index 505f22d595ca1b187d60e36db5aac4b9c25668f8..63e05a26453141b5844a67be669ddc62b6da4deb 100644 (file)
@@ -736,66 +736,7 @@ func Codeblk(ctxt *Link, out *OutBuf, addr int64, size int64) {
 }
 
 func CodeblkPad(ctxt *Link, out *OutBuf, addr int64, size int64, pad []byte) {
-       if *flagA {
-               ctxt.Logf("codeblk [%#x,%#x) at offset %#x\n", addr, addr+size, ctxt.Out.Offset())
-       }
-
        writeBlocks(out, ctxt.outSem, ctxt.Textp, addr, size, pad)
-
-       /* again for printing */
-       if !*flagA {
-               return
-       }
-
-       syms := ctxt.Textp
-       for i, s := range syms {
-               if !s.Attr.Reachable() {
-                       continue
-               }
-               if s.Value >= addr {
-                       syms = syms[i:]
-                       break
-               }
-       }
-
-       eaddr := addr + size
-       for _, s := range syms {
-               if !s.Attr.Reachable() {
-                       continue
-               }
-               if s.Value >= eaddr {
-                       break
-               }
-
-               if addr < s.Value {
-                       ctxt.Logf("%-20s %.8x|", "_", uint64(addr))
-                       for ; addr < s.Value; addr++ {
-                               ctxt.Logf(" %.2x", 0)
-                       }
-                       ctxt.Logf("\n")
-               }
-
-               ctxt.Logf("%.6x\t%-20s\n", uint64(addr), s.Name)
-               q := s.P
-
-               for len(q) >= 16 {
-                       ctxt.Logf("%.6x\t% x\n", uint64(addr), q[:16])
-                       addr += 16
-                       q = q[16:]
-               }
-
-               if len(q) > 0 {
-                       ctxt.Logf("%.6x\t% x\n", uint64(addr), q)
-                       addr += int64(len(q))
-               }
-       }
-
-       if addr < eaddr {
-               ctxt.Logf("%-20s %.8x|", "_", uint64(addr))
-               for ; addr < eaddr; addr++ {
-                       ctxt.Logf(" %.2x", 0)
-               }
-       }
 }
 
 const blockSize = 1 << 20 // 1MB chunks written at a time.
@@ -964,84 +905,10 @@ func DatblkBytes(ctxt *Link, addr int64, size int64) []byte {
 }
 
 func writeDatblkToOutBuf(ctxt *Link, out *OutBuf, addr int64, size int64) {
-       if *flagA {
-               ctxt.Logf("datblk [%#x,%#x) at offset %#x\n", addr, addr+size, ctxt.Out.Offset())
-       }
-
        writeBlocks(out, ctxt.outSem, ctxt.datap, addr, size, zeros[:])
-
-       /* again for printing */
-       if !*flagA {
-               return
-       }
-
-       syms := ctxt.datap
-       for i, sym := range syms {
-               if sym.Value >= addr {
-                       syms = syms[i:]
-                       break
-               }
-       }
-
-       eaddr := addr + size
-       for _, sym := range syms {
-               if sym.Value >= eaddr {
-                       break
-               }
-               if addr < sym.Value {
-                       ctxt.Logf("\t%.8x| 00 ...\n", uint64(addr))
-                       addr = sym.Value
-               }
-
-               ctxt.Logf("%s\n\t%.8x|", sym.Name, uint64(addr))
-               for i, b := range sym.P {
-                       if i > 0 && i%16 == 0 {
-                               ctxt.Logf("\n\t%.8x|", uint64(addr)+uint64(i))
-                       }
-                       ctxt.Logf(" %.2x", b)
-               }
-
-               addr += int64(len(sym.P))
-               for ; addr < sym.Value+sym.Size; addr++ {
-                       ctxt.Logf(" %.2x", 0)
-               }
-               ctxt.Logf("\n")
-
-               if ctxt.LinkMode != LinkExternal {
-                       continue
-               }
-               for i := range sym.R {
-                       r := &sym.R[i] // Copying sym.Reloc has measurable impact on performance
-                       rsname := ""
-                       rsval := int64(0)
-                       if r.Sym != nil {
-                               rsname = r.Sym.Name
-                               rsval = r.Sym.Value
-                       }
-                       typ := "?"
-                       switch r.Type {
-                       case objabi.R_ADDR:
-                               typ = "addr"
-                       case objabi.R_PCREL:
-                               typ = "pcrel"
-                       case objabi.R_CALL:
-                               typ = "call"
-                       }
-                       ctxt.Logf("\treloc %.8x/%d %s %s+%#x [%#x]\n", uint(sym.Value+int64(r.Off)), r.Siz, typ, rsname, r.Add, rsval+r.Add)
-               }
-       }
-
-       if addr < eaddr {
-               ctxt.Logf("\t%.8x| 00 ...\n", uint(addr))
-       }
-       ctxt.Logf("\t%.8x|\n", uint(eaddr))
 }
 
 func Dwarfblk(ctxt *Link, out *OutBuf, addr int64, size int64) {
-       if *flagA {
-               ctxt.Logf("dwarfblk [%#x,%#x) at offset %#x\n", addr, addr+size, ctxt.Out.Offset())
-       }
-
        // Concatenate the section symbol lists into a single list to pass
        // to writeBlocks.
        //
index fe65d944c1fbdcf5aa7fce428f903a9f10984577..07ed057bf6f939f3f11cfcb70acd5abf58d6532f 100644 (file)
@@ -74,7 +74,7 @@ var (
        flagExtldflags = flag.String("extldflags", "", "pass `flags` to external linker")
        flagExtar      = flag.String("extar", "", "archive program for buildmode=c-archive")
 
-       flagA           = flag.Bool("a", false, "disassemble output")
+       flagA           = flag.Bool("a", false, "no-op (deprecated)")
        FlagC           = flag.Bool("c", false, "dump call graph")
        FlagD           = flag.Bool("d", false, "disable dynamic executable")
        flagF           = flag.Bool("f", false, "ignore version mismatch")
index b0c0c5d65cf1b0a9c359bedb5678fdbf5a4fcd3a..e4f30ffb31c5eada73da93dee39400b0f28b512e 100644 (file)
@@ -1391,45 +1391,6 @@ func (f *xcoffFile) writeLdrScn(ctxt *Link, globalOff uint64) {
        }
 
        f.loaderSize = off + uint64(stlen)
-
-       /* again for printing */
-       if !*flagA {
-               return
-       }
-
-       ctxt.Logf("\n.loader section")
-       // write in buf
-       var buf bytes.Buffer
-
-       binary.Write(&buf, ctxt.Arch.ByteOrder, hdr)
-       for _, s := range symtab {
-               binary.Write(&buf, ctxt.Arch.ByteOrder, s)
-
-       }
-       for _, f := range importtab {
-               buf.WriteString(f.Limpidpath)
-               buf.WriteByte(0)
-               buf.WriteString(f.Limpidbase)
-               buf.WriteByte(0)
-               buf.WriteString(f.Limpidmem)
-               buf.WriteByte(0)
-       }
-       for _, s := range strtab {
-               binary.Write(&buf, ctxt.Arch.ByteOrder, s.size)
-               buf.WriteString(s.name)
-               buf.WriteByte(0) // null terminator
-       }
-
-       // Log buffer
-       ctxt.Logf("\n\t%.8x|", globalOff)
-       for i, b := range buf.Bytes() {
-               if i > 0 && i%16 == 0 {
-                       ctxt.Logf("\n\t%.8x|", uint64(globalOff)+uint64(i))
-               }
-               ctxt.Logf(" %.2x", b)
-       }
-       ctxt.Logf("\n")
-
 }
 
 // XCOFF assembling and writing file