]> Cypherpunks.ru repositories - gostls13.git/commit
[release-branch.go1.20] cmd/link: use label symbols for Duff's devices on darwin...
authorCherry Mui <cherryyz@google.com>
Wed, 8 Mar 2023 21:38:32 +0000 (16:38 -0500)
committerCherry Mui <cherryyz@google.com>
Wed, 15 Mar 2023 20:12:19 +0000 (20:12 +0000)
commitfa42da156a166ecf81ab7d72f53619ad9e6f134a
treec0a4fc09074bd28e68072eba46db2cdc3181b0e8
parent5c7cc468a8dacc032c4eddea6d5e7fc089d2f517
[release-branch.go1.20] 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.

Updates #58935.
Fixes #58954.

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>
(cherry picked from commit 7dbd6de7d45da622e532e149de616e159286e1d4)
Reviewed-on: https://go-review.googlesource.com/c/go/+/475175
src/cmd/link/internal/arm64/asm.go