-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
linkers: basic support for the 'zig cc' linker #12293
base: master
Are you sure you want to change the base?
Conversation
Mind adding a release notes snippet? Just something simple with an example on how to us it would be good enough |
I'll add a release snippet but I'm sure if a usage example is necessary. You use it like any other compiler; |
Previously, #11918 This PR seems to be better as it resolves an outstanding review comment from that PR about adding a unique linker class, and even smooths over some incompatibilities. ;) I would still like to see zig installed in CI and tested, in addition to the release notes. Please also see the comment there about -fuse-ld. |
You can squash the commits. Thanks! |
Now that I think about it, the linker id should probably be |
@eli-schwartz |
Some of the comments in the other PR seem inaccurate.
There's no error or even a warning; as I said above,
|
I might be working on that. For the moment Zig looks more like Rust, generating a final output directly. Like Rust it can compile object files but getting Meson to the point it does that will be non-trivial. I would prefer that the linker be called someting other than just |
@dcbaker |
The thing is (as the person who named them) I literally used the name of the file on disk. "ld.bfd", "ld.gold" and "ld.lld". I guess since then we've added ld.solaris, even though I'm pretty sure that's not the on disk name. I guess I can live with ld.zig or ld.zigcc. Just not zig itself, because that will cause confusion if I ever send out the actual zig patches (I haven't yet because it's super unreliable without depfile support and I never go around to writing those patches for zig itself) |
That would be certainly nice to have but I think this PR shouldn't be blocked on that. Meson is the only build system that outright refuses to work with any compiler or linker it doesn't recognize. In my opinion, this design is only acceptable if it's very easy to contribute best-effort support for unknown toolchains. Adding zig tests into CI would be 10 times more effort than writing this patch was, and frankly I would probably rather trick meson with a hacky compiler wrapper on my end than deal with that. |
Rebased, squashed, and renamed the linker again to |
I'm (still) of the opinion that if someone was going to invest in writing a POSIXCCompiler class I'd like to merge such functionality. Anyways...
Then please confirm that you ran the testsuite locally with the relevant linker selection environment variable exported and the tests passed. |
@Akaricchi If you can confirm that this passes the test suite with zigcc run locally than I think @eli-schwartz and I are in agreement this can land. |
To be clear, that's exactly what we do, in fact, do when for example people submit support for proprietary compilers that require a bunch of unusual tweaks. We ask them to confirm on the honor system that they ran the testsuite. Sometimes after they do that they discover a bunch of issues they were previously unaware of, and add new commits to fix those too. |
See also #8579. |
@bruchar1 i have an updated version of that PR. I’m hesitant to send it out without depfile support in zig itself. |
Really looking forward to this landing! Is there anything I could do to help get this merged? |
@henrytill Run the Meson test suite with |
Unfortunately, I'm getting quite a few failures using Zig 0.11.0 (current stable release). Command:
Output: Output of
|
I didn't look too deeply, but it appears that |
I've made a patch which should fix the test errors #13493 |
Zig has a C/C++ compiler frontend that may be useful for cross-compiling. The compiler presents as clang (because it actually is), but since zig 0.11.0 the linker reports itself as
zig ld
, which confuses meson. It seems mostly compatible with lld, except lacking support for--thinlto-cache-dir
(for now?).I haven't tested this too thoroughly, but I was able to build the latest Taisei with this patch and a trivial cross file, for linux and windows.