From: Cherry Zhang Date: Fri, 3 Apr 2020 02:12:38 +0000 (-0400) Subject: cmd/internal/obj/mips: don't emit spurious CALLIND relocations X-Git-Tag: go1.15beta1~671 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5dde10c3044f75fbcc29193608a7b7156a3c9ef6;p=gostls13.git cmd/internal/obj/mips: don't emit spurious CALLIND relocations Generate a CALLIND relocation only for indirect calls, not for indirect jumps. In particular, the RET instruction is lowered to JMP (LR), an indirect jump, and occurs frequently. The large amount of spurious relocations causes the linker to do a lot of extra work. Change-Id: Ie0edc04609788f5a687fd00c22558c3f83867697 Reviewed-on: https://go-review.googlesource.com/c/go/+/227079 Run-TryBot: Cherry Zhang TryBot-Result: Gobot Gobot Reviewed-by: Than McIntosh Reviewed-by: David Chase --- diff --git a/src/cmd/internal/obj/mips/asm0.go b/src/cmd/internal/obj/mips/asm0.go index 5bbcb01444..13d875ed3a 100644 --- a/src/cmd/internal/obj/mips/asm0.go +++ b/src/cmd/internal/obj/mips/asm0.go @@ -1355,10 +1355,12 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) { r = int(o.param) } o1 = OP_RRR(c.oprrr(p.As), uint32(0), uint32(p.To.Reg), uint32(r)) - rel := obj.Addrel(c.cursym) - rel.Off = int32(c.pc) - rel.Siz = 0 - rel.Type = objabi.R_CALLIND + if p.As == obj.ACALL { + rel := obj.Addrel(c.cursym) + rel.Off = int32(c.pc) + rel.Siz = 0 + rel.Type = objabi.R_CALLIND + } case 19: /* mov $lcon,r ==> lu+or */ // NOTE: this case does not use REGTMP. If it ever does,