]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.8] cmd/internal/obj/x86: use LEAx rather than ADDx when calling...
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Wed, 26 Apr 2017 23:56:42 +0000 (11:56 +1200)
committerRuss Cox <rsc@golang.org>
Fri, 20 Oct 2017 16:42:12 +0000 (12:42 -0400)
commit03d6e3722aea380a826de304dfedb7b30d7482e5
treea6e0efa5d845d17ad9b376a5c3e93d68c6897572
parentbc7fb45f5a36c3bd7b81b9c6bf039f1ceec589e2
[release-branch.go1.8] cmd/internal/obj/x86: use LEAx rather than ADDx when calling DUFFxxxx via GOT

DUFFZERO on 386 is not marked as clobbering flags, but rewriteToUseGot rewrote
"ADUFFZERO $offset" to "MOVL runtime.duffxxx@GOT, CX; ADDL $offset, CX; CALL CX"
which does. Luckily the fix is easier than figuring out what the problem was:
replace the ADDL $offset, CX with LEAL $offset(CX), CX.

On amd64 DUFFZERO clobbers flags, on arm, arm64 and ppc64 ADD does not clobber
flags and s390x does not use the duff functions, so I'm fairly confident this
is the only fix required.

I don't know how to write a test though.

Change-Id: I69b0958f5f45771d61db5f5ecb4ded94e8960d4d
Reviewed-on: https://go-review.googlesource.com/41821
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/internal/obj/x86/obj6.go