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
case sys.RISCV64:
// TODO(jsing): The JALR instruction is marked with
// R_CALLRISCV, whereas the actual reloc is currently
- // two instructions earlier for the AUIPC+AADI sequence.
- deferreturn -= 8
+ // one instruction earlier starting with the AUIPC.
+ deferreturn -= 4
case sys.S390X:
deferreturn -= 2
default:
// func jmpdefer(fv *funcval, argp uintptr)
// called from deferreturn
// 1. grab stored return address from the caller's frame
-// 2. sub 12 bytes to get back to JAL deferreturn
+// 2. sub 8 bytes to get back to JAL deferreturn
// 3. JMP to fn
-// TODO(sorear): There are shorter jump sequences. This function will need to be updated when we use them.
TEXT runtime·jmpdefer(SB), NOSPLIT|NOFRAME, $0-16
MOV 0(X2), RA
- ADD $-12, RA
+ ADD $-8, RA
MOV fv+0(FP), CTXT
MOV argp+8(FP), X2