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: LLVM's LLD does not create working Windows executables #44250
Comments
Related: #39326. For that bug, the musl.cc clang compilers are being used. |
Musl.cc uses gcc/binutils, not clang, and doesn't support arm or arm64 consequently. |
Whoops, yes, you are right. Same symptom however (use of lld results in non-working executable). |
Change https://golang.org/cl/291630 mentions this issue: |
I've got a working fix now -- https://golang.org/cl/291630 . This should clear the way for doing cgo on windows/arm{64}. |
Change https://golang.org/cl/291632 mentions this issue: |
Change https://golang.org/cl/291633 mentions this issue: |
This is only a valid option on ELF. Binutils accepts it, but LLVM rejects it, so for Windows, it's best to just omit it. Updates #44250. Updates #39326. Updates #38755. Updates #36439. Updates #43800. Change-Id: Iffd2345d757f23dd737e63bd464cd412527077c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/291632 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
Without setting these flags, LLVM's LLD ignores the .ctors section when merging objects. Updates #44250. Updates #39326. Updates #38755. Updates #36439. Updates #43800. Change-Id: I8766104508f7acd832088a590ee7d68afa0d6065 Reviewed-on: https://go-review.googlesource.com/c/go/+/291633 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
I'm still uncertain whether we're missing a config option for LLD to get the behavior we want, or if this is a bug in LLD. I've filed this with LLVM: https://bugs.llvm.org/show_bug.cgi?id=49172
It looks like all of the go object is being merged into one readable/executable section, which then crashes on writes to data. I haven't figured out why yet.
Fixing this is an important step in getting cgo rolling with arm and arm64 on Windows, since there's no working binutils there.
Affects #38755, #36439, #43800.
CC @rsc @alexbrainman @cherrymui @mstorsjo
The text was updated successfully, but these errors were encountered: