]> Cypherpunks.ru repositories - gostls13.git/commitdiff
[release-branch.go1.20] cmd/link: force old Apple linker in plugin mode
authorCherry Mui <cherryyz@google.com>
Tue, 12 Sep 2023 19:40:09 +0000 (15:40 -0400)
committerCherry Mui <cherryyz@google.com>
Thu, 21 Sep 2023 22:20:16 +0000 (22:20 +0000)
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>
src/cmd/link/internal/ld/lib.go

index 03b9f11608d3de1f5f35ac3ba6247af9e8acd0a2..c44983144d6017c0a545c1fbaff555c82d511fa0 100644 (file)
@@ -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.