]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.21] cmd/link: use symbol-targeted relocation for initializers...
authorCherry Mui <cherryyz@google.com>
Mon, 12 Jun 2023 17:42:30 +0000 (13:42 -0400)
committerCherry Mui <cherryyz@google.com>
Wed, 2 Aug 2023 17:38:41 +0000 (17:38 +0000)
commita3b092d65e2df7584e452508a6a1ddc0d861a010
tree7a0d02c9c96b39e71e482345a5405657d7cc184e
parent07c72a0915093feb9837dbcbc963810a3efcb6b6
[release-branch.go1.21] cmd/link: use symbol-targeted relocation for initializers on Mach-O

Apple's new linker, ld-prime from Xcode 15 beta, when handling
initializers in __mod_init_func, drops the offset in the data,
resolving the relocation to the beginning of the section. The
latest version of ld-prime rejects non-zero addend. We need to use
symbol-targeted "external" relocations, so that it doesn't need
an addend and can be resolved correctly. This also works fine with
ld64.

Fixes #60694.
For #61229.

Change-Id: Ida2be6aa4c91bfcd142b755e2ec63aabfbbd77a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/502616
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit bad9ca8a612f6fae85cfc25e07e69ed30384fc84)
Reviewed-on: https://go-review.googlesource.com/c/go/+/514535
src/cmd/link/internal/amd64/asm.go
src/cmd/link/internal/arm64/asm.go
src/cmd/link/internal/ld/data.go