]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: ecx is reserved for PIC, don't let peep work on it
authorKeith Randall <khr@golang.org>
Sat, 30 Apr 2016 00:10:02 +0000 (17:10 -0700)
committerKeith Randall <khr@golang.org>
Sat, 30 Apr 2016 05:59:54 +0000 (05:59 +0000)
Fixes #15496

Change-Id: Ieb5be1caa4b1c23e23b20d56c1a0a619032a9f5d
Reviewed-on: https://go-review.googlesource.com/22652
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
src/cmd/compile/internal/x86/peep.go

index dfbe9d20236125d715f407a42136ed22631dd3d1..0a4ecc0e5cf1679d15c46ff969576c1a8647df86 100644 (file)
@@ -249,6 +249,10 @@ func excise(r *gc.Flow) {
 }
 
 func regtyp(a *obj.Addr) bool {
+       if gc.Ctxt.Flag_shared && a.Type == obj.TYPE_REG && a.Reg == x86.REG_CX {
+               // don't propagate CX, it is used implicitly by PIC global references
+               return false
+       }
        return a.Type == obj.TYPE_REG && (x86.REG_AX <= a.Reg && a.Reg <= x86.REG_DI || x86.REG_X0 <= a.Reg && a.Reg <= x86.REG_X7)
 }