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>
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