]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj/x86: use LEAx rather than ADDx when calling DUFFxxxx via GOT
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Wed, 26 Apr 2017 23:56:42 +0000 (11:56 +1200)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Mon, 1 May 2017 18:57:35 +0000 (18:57 +0000)
commit1f85d3ad09152e09d5f4e9b6d9dcec72dbb4ad9b
tree73067856b4b59d461e2b49be8c909d2911a4396a
parenta2da2108ee18a338cdcdea5e319156858031af08
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