Skip to content

Commit

Permalink
[release-branch.go1.21] cmd/link: force old Apple linker in plugin mode
Browse files Browse the repository at this point in the history
There are some bugs in Apple's new linker that causes plugins to
be built incorrectly. And the bugs probably will not be fixed when
Xcode 15 is released (some time soon). Force old Apple linker to
work around.

Updates #61229.
For #62598.

Change-Id: I01ba5caadec6dc14f8c85dd02f78c1ed2e8b7d4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/527815
Run-TryBot: Cherry Mui <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Than McIntosh <[email protected]>
  • Loading branch information
cherrymui committed Sep 21, 2023
1 parent 556e9c3 commit 3ef4f93
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cmd/link/internal/ld/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,10 @@ func (ctxt *Link) hostlink() {
// resolving a lazy binding. See issue 38824.
// Force eager resolution to work around.
argv = append(argv, "-Wl,-flat_namespace", "-Wl,-bind_at_load")
if linkerFlagSupported(ctxt.Arch, argv[0], "", "-Wl,-ld_classic") {
// Force old linker to work around a bug in Apple's new linker.
argv = append(argv, "-Wl,-ld_classic")
}
}
if !combineDwarf {
argv = append(argv, "-Wl,-S") // suppress STAB (symbolic debugging) symbols
Expand Down

0 comments on commit 3ef4f93

Please sign in to comment.