1
0
mirror of https://github.com/golang/go synced 2024-11-20 01:14:40 -07:00

cmd/internal/ld: maintain Ctxt.Etextp when removing dead code

I wrote some code that added a function in gentext() by sticking it
after Ctxt.Etextp and was very confused when this wasn't written out
sometimes. It turned out that Etextp was not updated by deadcode() so
if the last function is not reachable, my new function was never
seen. This changes deadcode() to update Etextp to the last reachable
funtion.

Change-Id: Ib6a3e7c67ccfb8a15826ce9e0ef046732b5e25d2
Reviewed-on: https://go-review.googlesource.com/8233
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Michael Hudson-Doyle 2015-03-29 23:27:58 +00:00 committed by Ian Lance Taylor
parent 09b3bf42c7
commit 8e9c6431f0

View File

@ -656,8 +656,10 @@ func deadcode() {
if last == nil {
Ctxt.Textp = nil
Ctxt.Etextp = nil
} else {
last.Next = nil
Ctxt.Etextp = last
}
for s := Ctxt.Allsym; s != nil; s = s.Allsym {