]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/arm64: only emit R_CALLIND relocations on calls
authorCherry Zhang <cherryyz@google.com>
Wed, 7 Oct 2020 18:39:47 +0000 (14:39 -0400)
committerCherry Zhang <cherryyz@google.com>
Wed, 7 Oct 2020 20:18:43 +0000 (20:18 +0000)
Don't emit it for jumps. In particular, not for the return
instruction, which is JMP (LR).

Reduce some binary size and linker resources.

Change-Id: Idb3242b86c5a137597fb8accb8aadfe0244c14cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/260341
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/internal/obj/arm64/asm7.go

index ee4a33eef4b791c540cdbac2fceb0c853d2e6eea..7c35fce106b971bd36574ab74679649c70344082 100644 (file)
@@ -3120,12 +3120,13 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
 
        case 6: /* b ,O(R); bl ,O(R) */
                o1 = c.opbrr(p, p.As)
-
                o1 |= uint32(p.To.Reg&31) << 5
-               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 7: /* beq s */
                o1 = c.opbra(p, p.As)