aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2023-09-12 15:40:09 -0400
committerCherry Mui <cherryyz@google.com>2023-09-21 22:20:16 +0000
commit071f03a8e59fc404a823e547fa566983c60f1f07 (patch)
tree0c4fa90c7ab08aa1df6b5dd701dbff9be65e1bb4
parentd5b851804329aa547dafa278a0c35dd62298d651 (diff)
downloadgo-071f03a8e59fc404a823e547fa566983c60f1f07.tar.gz
go-071f03a8e59fc404a823e547fa566983c60f1f07.zip
[release-branch.go1.20] cmd/link: force old Apple linker in plugin mode
There are some bugs in Apple's new linker that probably will not be fixed when Xcode 15 is released (some time soon). We fix/work around them but it is too much to backport them all. Force old Apple linker to work around. Updates #61229. For #62597. Change-Id: Ia5941918e882b22b4dbc41c74764d19d413d0b56 Reviewed-on: https://go-review.googlesource.com/c/go/+/527818 Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
-rw-r--r--src/cmd/link/internal/ld/lib.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index 03b9f11608..c44983144d 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -1367,6 +1367,10 @@ func (ctxt *Link) hostlink() {
switch ctxt.HeadType {
case objabi.Hdarwin:
+ if linkerFlagSupported(ctxt.Arch, argv[0], "", "-Wl,-ld_classic") {
+ // Force old linker to work around bugs in Apple's new linker.
+ argv = append(argv, "-Wl,-ld_classic")
+ }
if combineDwarf {
// Leave room for DWARF combining.
// -headerpad is incompatible with -fembed-bitcode.