mirror of
https://github.com/golang/go
synced 2024-11-19 14:44:40 -07:00
[dev.cc] cmd/asm: fix build for x86 architectures
Mishandled the complex addressing mode in masks<>(SB)(CX*8) as a casualty of the ARM work. Fix by backing all the flows up to the state where registerIndirect is always called with the input sitting on the opening paren. With this, build passes for me with linux-arm, linux-386, and linux-amd64. Change-Id: I7cae69a6fa9b635c79efd93850bd1e744b22bc79 Reviewed-on: https://go-review.googlesource.com/4964 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
188296e5bf
commit
68bcc13291
@ -313,6 +313,9 @@ func (p *Parser) operand(a *obj.Addr) bool {
|
||||
rname := p.next().String()
|
||||
p.back()
|
||||
haveConstant = !p.isRegister(rname)
|
||||
if !haveConstant {
|
||||
p.back() // Put back the '('.
|
||||
}
|
||||
}
|
||||
if haveConstant {
|
||||
p.back()
|
||||
@ -355,10 +358,9 @@ func (p *Parser) operand(a *obj.Addr) bool {
|
||||
return true
|
||||
}
|
||||
// fmt.Printf("offset %d \n", a.Offset)
|
||||
p.get('(')
|
||||
}
|
||||
|
||||
// Register indirection: (reg) or (index*scale). We have consumed the opening paren.
|
||||
// Register indirection: (reg) or (index*scale). We are on the opening paren.
|
||||
p.registerIndirect(a, prefix)
|
||||
// fmt.Printf("DONE %s\n", p.arch.Dconv(&emptyProg, 0, a))
|
||||
|
||||
@ -505,7 +507,7 @@ func (p *Parser) symbolReference(a *obj.Addr, name string, prefix rune) {
|
||||
// setPseudoRegister sets the NAME field of addr for a pseudo-register reference such as (SB).
|
||||
func (p *Parser) setPseudoRegister(addr *obj.Addr, name string, reg int16, isStatic bool, prefix rune) {
|
||||
if addr.Reg != 0 {
|
||||
p.errorf("internal error: reg already set in psuedo")
|
||||
p.errorf("internal error: reg %s already set in pseudo", name)
|
||||
}
|
||||
switch reg {
|
||||
case arch.RFP:
|
||||
@ -535,8 +537,9 @@ func (p *Parser) setPseudoRegister(addr *obj.Addr, name string, reg int16, isSta
|
||||
// It is can be (R1), (R2*scale), or (R1)(R2*scale) where R1 may be a simple
|
||||
// register or register pair R:R or (R, R).
|
||||
// Or it might be a pseudo-indirection like (FP).
|
||||
// The opening parenthesis has already been consumed.
|
||||
// We are sitting on the opening parenthesis.
|
||||
func (p *Parser) registerIndirect(a *obj.Addr, prefix rune) {
|
||||
p.get('(')
|
||||
tok := p.next()
|
||||
name := tok.String()
|
||||
r1, r2, scale, ok := p.register(name, 0)
|
||||
|
Loading…
Reference in New Issue
Block a user