Commit 8e9c6431 authored by Michael Hudson-Doyle's avatar Michael Hudson-Doyle Committed by Ian Lance Taylor

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/8233Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 09b3bf42
......@@ -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 {
......
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