From: Michael Hudson-Doyle Date: Sun, 29 Mar 2015 23:27:58 +0000 (+0000) Subject: cmd/internal/ld: maintain Ctxt.Etextp when removing dead code X-Git-Tag: go1.5beta1~1308 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8e9c6431f06da0c2e4f77dab23b86c0b98b9174c;p=gostls13.git 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 --- diff --git a/src/cmd/internal/ld/go.go b/src/cmd/internal/ld/go.go index c50e82b60d..1aab4f9680 100644 --- a/src/cmd/internal/ld/go.go +++ b/src/cmd/internal/ld/go.go @@ -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 {