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>
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.