-
Notifications
You must be signed in to change notification settings - Fork 17.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/link: issues with Apple's new linker in Xcode 15 beta [1.20 backport] #62597
Comments
Xcode 15 (to be released some time soon) will include Apple's new linker, enabled by default. There are a number of issues with running Go 1.20 with the new Apple linker, from linker warnings to program fail to run. There are a number of fixes/workarounds included in Go 1.21 and tip, but I think they are too many to backport. So for 1.20, I propose we force to use the old Apple linker. I'm pretty sure the old Apple linker will be around for long enough time to cover the lifetime of Go 1.20. We also want to backport CL https://go.dev/cl/527415, to disable DWARF by default for c-shared mode (otherwise the new Apple linker doesn't accept the c-shared object). We need this because the user may link the c-shared object with C code without going through the Go toolchain, so can't force old linker for this. We also want to backport CL https://go.dev/cl/508696, which suppresses a warning. Apparently, although the old linker doesn't emit the warning and we pass a flag to force the old linker, it still emits the warning, probably because the new linker parses flags before exec'ing the old linker. Specifically, CLs to be included in Go 1.20 branch:
|
Change https://go.dev/cl/527798 mentions this issue: |
Change https://go.dev/cl/527818 mentions this issue: |
Change https://go.dev/cl/527819 mentions this issue: |
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>
…d mode on darwin [This is a (manual) backport of CL 527415 to Go 1.20.] Currently, linking a Go c-shared object with C code using Apple's new linker, it fails with % cc a.c go.so ld: segment '__DWARF' filesize exceeds vmsize in 'go.so' Apple's new linker has more checks for unmapped segments. It is very hard to make it accept a Mach-O shared object with an additional DWARF segment. We may want to stop combinding DWARF into the shared object (see also #62577). For now, disable DWARF by default in c-shared mode on darwin. Updates #61229. For #62597. Change-Id: I313349f71296d6d7025db28469593825ce9f1866 Reviewed-on: https://go-review.googlesource.com/c/go/+/527819 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com>
…warning for ld-prime ld-prime emits a deprecation warning for -bind_at_load. The flag is needed for plugins to not deadlock (#38824) when linking with older darwin linker. It is supposedly not needed with newer linker when chained fixups are used. For now, we always pass it, and suppress the warning. Updates #61229. For #62597. Change-Id: I4b8a6f864a460c40dc38adbb533f664f7fd5343c Reviewed-on: https://go-review.googlesource.com/c/go/+/508696 Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com> (cherry picked from commit 040dbf9) Reviewed-on: https://go-review.googlesource.com/c/go/+/527798
Closed by merging 071f03a to release-branch.go1.20. |
Closed by merging 08c544d to release-branch.go1.20. |
Closed by merging 83dce45 to release-branch.go1.20. |
This is a major issue for us... do you think it's going to be a while before a patch release with this fix? |
The next Go 1.20.9 release will likely be available next week. In the mean time, you can build Go from source using the |
-Wl,-force_load flag need to be ignored when check ld_classic is supported in linkerFlagSupported. |
Where is |
We pass As the |
So you suggest adding On the other hand, we don't test |
@cherrymui requested issue #61229 to be considered for backport to the next 1.20 minor release.
The text was updated successfully, but these errors were encountered: