cmd/link: convert textp into a slice

Updates #15374

Change-Id: I3ea715735862fe9550b88d7a29def6cb9d4419a6
Reviewed-on: https://go-review.googlesource.com/22243
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
This commit is contained in:
David Crawshaw 2016-04-19 14:02:21 -04:00
parent 5a0881a1d1
commit 7d56215bcb
19 changed files with 71 additions and 168 deletions

View file

@ -119,25 +119,13 @@ func deadcode(ctxt *Link) {
}
// Remove dead text but keep file information (z symbols).
var last *LSym
for s := ctxt.Textp; s != nil; s = s.Next {
if !s.Attr.Reachable() {
continue
textp := make([]*LSym, 0, len(ctxt.Textp))
for _, s := range ctxt.Textp {
if s.Attr.Reachable() {
textp = append(textp, s)
}
if last == nil {
ctxt.Textp = s
} else {
last.Next = s
}
last = s
}
if last == nil {
ctxt.Textp = nil
ctxt.Etextp = nil
} else {
last.Next = nil
ctxt.Etextp = last
}
ctxt.Textp = textp
}
var markextra = []string{