Commit 8ce80ce8 authored by Russ Cox's avatar Russ Cox

cmd/link: make -a output not crash

Fixes #12107.

Change-Id: I62f1b6ac9fb6f2cfa3472253dc1c6f7b7d2a6faf
Reviewed-on: https://go-review.googlesource.com/13448Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
parent 1052b432
......@@ -778,7 +778,6 @@ func Codeblk(addr int64, size int64) {
}
eaddr := addr + size
var n int64
var q []byte
for ; sym != nil; sym = sym.Next {
if !sym.Reachable {
......@@ -797,20 +796,18 @@ func Codeblk(addr int64, size int64) {
}
fmt.Fprintf(&Bso, "%.6x\t%-20s\n", uint64(int64(addr)), sym.Name)
n = sym.Size
q = sym.P
for n >= 16 {
fmt.Fprintf(&Bso, "%.6x\t%-20.16I\n", uint64(addr), q)
for len(q) >= 16 {
fmt.Fprintf(&Bso, "%.6x\t% x\n", uint64(addr), q[:16])
addr += 16
q = q[16:]
n -= 16
}
if n > 0 {
fmt.Fprintf(&Bso, "%.6x\t%-20.*I\n", uint64(addr), int(n), q)
if len(q) > 0 {
fmt.Fprintf(&Bso, "%.6x\t% x\n", uint64(addr), q)
addr += int64(len(q))
}
addr += n
}
if addr < eaddr {
......
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