• Michael Hudson-Doyle's avatar
    cmd/internal/obj/x86: use LEAx rather than ADDx when calling DUFFxxxx via GOT · 1f85d3ad
    Michael Hudson-Doyle authored
    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: 's avatarKeith Randall <khr@golang.org>
    1f85d3ad
Name
Last commit
Last update
..
a.out.go Loading commit data...
anames.go Loading commit data...
asm6.go Loading commit data...
issue19518_test.go Loading commit data...
list6.go Loading commit data...
obj6.go Loading commit data...
obj6_test.go Loading commit data...