]> 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>
Wed, 25 Oct 2017 18:57:16 +0000 (18:57 +0000)
commitb838f943ab3e3cb46e386e4541f0f1d2226c7958
treea6e0efa5d845d17ad9b376a5c3e93d68c6897572
parent3be9637d5658535714baeed1994af39342c5066c
[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>
Reviewed-on: https://go-review.googlesource.com/70871
Run-TryBot: Russ Cox <rsc@golang.org>
src/cmd/internal/obj/x86/obj6.go