• Rémy Oudompheng's avatar
    cmd/8l: fix misassembling of MOVB involving (AX)(BX*1) · 354a3a15
    Rémy Oudompheng authored
    The linker accepts MOVB involving non-byte-addressable
    registers, by generating XCHG instructions to AX or BX.
    It does not handle the case where nor AX nor BX are available.
    
    See also revision 1470920a2804.
    
    Assembling
        TEXT ·Truc(SB),7,$0
        MOVB BP, (BX)(AX*1)
        RET
    
    gives before:
       08048c60 <main.Truc>:
        8048c60:       87 dd         xchg   %ebx,%ebp
        8048c62:       88 1c 03      mov    %bl,(%ebx,%eax,1)
        8048c65:       87 dd         xchg   %ebx,%ebp
        8048c67:       c3            ret
    
    and after:
       08048c60 <main.Truc>:
        8048c60:       87 cd         xchg   %ecx,%ebp
        8048c62:       88 0c 03      mov    %cl,(%ebx,%eax,1)
        8048c65:       87 cd         xchg   %ecx,%ebp
        8048c67:       c3            ret
    
    R=golang-dev, rsc
    CC=golang-dev
    https://golang.org/cl/7226066
    354a3a15
span.c 26.3 KB