mirror of
https://github.com/golang/go
synced 2024-11-11 23:50:22 -07:00
cmd/internal/obj/riscv: restore the ADDI instruction in jalrToSym
While this instruction is not needed for the relocation (the lower immediate can be patched directly into the JALR instruction), other code currently depends on the jump sequence being 12 bytes (or three instructions) long. Put the ADDI instruction back until these can be found and fixed. Updates #27532 Change-Id: Idb73d716be8eb2eb796591b30f1ec4dc104f2bf8 Reviewed-on: https://go-review.googlesource.com/c/go/+/215840 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
fa610c776e
commit
9f07cdd99e
@ -55,6 +55,15 @@ func jalrToSym(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc, lr int16) *ob
|
||||
p.Mark |= NEED_PCREL_ITYPE_RELOC
|
||||
p = obj.Appendp(p, newprog)
|
||||
|
||||
// TODO(jsing): This instruction is not necessary, as the lower bits
|
||||
// of the immediate can be encoded directly in the JALR instruction.
|
||||
// However, other code currently depends on jalrToSym being 12 bytes...
|
||||
p.As = AADDI
|
||||
p.From = obj.Addr{Type: obj.TYPE_CONST}
|
||||
p.Reg = REG_TMP
|
||||
p.To = obj.Addr{Type: obj.TYPE_REG, Reg: REG_TMP}
|
||||
p = obj.Appendp(p, newprog)
|
||||
|
||||
// Leave Sym only for the CALL reloc in assemble.
|
||||
p.As = AJALR
|
||||
p.From.Type = obj.TYPE_REG
|
||||
|
Loading…
Reference in New Issue
Block a user