]> Cypherpunks repositories - gostls13.git/commit
cmd/link: support trampoline insertion for PLT calls on ARM64
authorCherry Zhang <cherryyz@google.com>
Tue, 27 Apr 2021 14:57:09 +0000 (10:57 -0400)
committerCherry Zhang <cherryyz@google.com>
Thu, 29 Apr 2021 15:21:34 +0000 (15:21 +0000)
commit657f58d845e83c47c7d4b7638ccbee8e5a2acbf5
tree61e665bf9cbfdb94b5b68dd8d012bf2e969dde6d
parentf12dfeac89637dd509cb3eaa81d3116fc49a4daf
cmd/link: support trampoline insertion for PLT calls on ARM64

When internal linking with C objects, some C object relocations
may be turned into a CALL via PLT. For very large programs, the
PLT stub may be laid too far.

PLT stubs are generated late in the linker, and laid out after
the end of the text section. So if the text section is big, the
PLT stubs are likely too far.

To avoid this situation, add trampolines for PLT calls in the
trampoline pass. Only do this when the program is known too large
(i.e. the second pass of the two-pass algorithm).

Updates #40492.

Change-Id: I21f65d6cbc6bde84e3cf9c2ae05f5233df6cfa72
Reviewed-on: https://go-review.googlesource.com/c/go/+/314452
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/arm64/asm.go
src/cmd/link/internal/ld/data.go