]> Cypherpunks repositories - gostls13.git/commit
cmd/link: use label symbols for Duff's devices on darwin/arm64
authorCherry Mui <cherryyz@google.com>
Wed, 8 Mar 2023 21:38:32 +0000 (16:38 -0500)
committerCherry Mui <cherryyz@google.com>
Thu, 9 Mar 2023 21:23:53 +0000 (21:23 +0000)
commit7dbd6de7d45da622e532e149de616e159286e1d4
tree538cf2ed81d8558eaf4bac76707b47db860a3409
parent7042ea62da0f9d3f39e902352484ef30a746641b
cmd/link: use label symbols for Duff's devices on darwin/arm64

On darwin, the external linker generally supports CALL relocations
with addend. One exception is that for a very large binary when it
decides to insert a trampoline, instead of applying the addend to
the call target (in the trampoline), it applies the addend to the
CALL instruction in the caller, i.e. generating a call to
trampoline+addend, which is not the correct address and usually
points to unreloated functions.

To work around this, we use label symbols so the CALL is targeting
a label symbol without addend. To make things simple we always use
label symbols for CALLs with addend (in external linking mode on
darwin/arm64), even for small binaries.

Fixes #58935.

Change-Id: I38aed6b62a0496c277c589b5accbbef6aace8dd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/474620
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/arm64/asm.go