]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: fix Codeblk printing when -a to use Textp as a slice
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Thu, 21 Apr 2016 21:38:41 +0000 (09:38 +1200)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Thu, 21 Apr 2016 22:43:53 +0000 (22:43 +0000)
Does anyone actually pass -a to the linker?

Change-Id: I1d31ea66aa5604b7fd42adf15bdab71e9f52d0ed
Reviewed-on: https://go-review.googlesource.com/22356
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
src/cmd/link/internal/ld/data.go

index 8d20096dcf851a68feaed8ed019e0be60c839831..6fc6de3818c566eb8186b570d81560695ce15b90 100644 (file)
@@ -798,19 +798,20 @@ func Codeblk(addr int64, size int64) {
                return
        }
 
-       var sym *LSym
-       for _, sym = range Ctxt.Textp {
+       syms := Ctxt.Textp
+       for i, sym := range syms {
                if !sym.Attr.Reachable() {
                        continue
                }
                if sym.Value >= addr {
+                       syms = syms[i:]
                        break
                }
        }
 
        eaddr := addr + size
        var q []byte
-       for ; sym != nil; sym = sym.Next {
+       for _, sym := range syms {
                if !sym.Attr.Reachable() {
                        continue
                }