aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj/objfile.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2016-02-23 10:54:36 -0800
committerKeith Randall <khr@golang.org>2016-02-24 00:16:23 +0000
commite360f7c4dbb5695fc4cadb3d400e36ec09327732 (patch)
tree18d6bd05ddd831a605be5cc3e171a0e1b389b697 /src/cmd/internal/obj/objfile.go
parentc4cb365ea23f4e3bd571f63a16d59ad6c01df145 (diff)
downloadgo-e360f7c4dbb5695fc4cadb3d400e36ec09327732.tar.xz
cmd/compile: keep JMPs around with -N
When -N, make sure we don't drop every instruction from a block, even ones which would otherwise be empty. Helps keep line numbers around for debugging, particularly for break and continue statements (which often compile down to nothing). Fixes #14379 Change-Id: I33722c4f0dcd502f146fa48af262ba3a477c959a Reviewed-on: https://go-review.googlesource.com/19854 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Minux Ma <minux@golang.org>
Diffstat (limited to 'src/cmd/internal/obj/objfile.go')
-rw-r--r--src/cmd/internal/obj/objfile.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/internal/obj/objfile.go b/src/cmd/internal/obj/objfile.go
index bae64f4a29..40c92dd152 100644
--- a/src/cmd/internal/obj/objfile.go
+++ b/src/cmd/internal/obj/objfile.go
@@ -295,7 +295,9 @@ func Flushplist(ctxt *Link) {
for s := text; s != nil; s = s.Next {
mkfwd(s)
linkpatch(ctxt, s)
- ctxt.Arch.Follow(ctxt, s)
+ if ctxt.Flag_optimize {
+ ctxt.Arch.Follow(ctxt, s)
+ }
ctxt.Arch.Preprocess(ctxt, s)
ctxt.Arch.Assemble(ctxt, s)
fieldtrack(ctxt, s)