-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Document Zig's built-in linker options #9407
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
Conversation
Why not just use |
@g-w1 This is on Zig 0.8.0. |
Ah, sorry, I meant, build-exe or build-lib, or build-obj. You can just pass the things you would like to link to args as to those programs. |
Is Like, can I set |
I do not think so, but also see #8755. |
The use case here is that I'm making a Linux distribution and a lot of build scripts (e.g. Autotools, CMake) automatically use the system linker rather than Zig's linker. I can override this by setting |
The problem is I had to do a lot of digging to find this information (including reading your IRC messages in the IRC log). I'm just submitting this patch so maybe the next person who is crazy enough to try to make a Linux distro based on Zig will have it slightly easier 😅 |
I think this is a workaround, it might not be that hard to just implement #8755 depending on the target os (may be a bit harder to hook up the self-hosted linker backends, but for linux, it should just be forwarding the args to |
I think it's going to be a long while still until |
Zig ld != self-hosted linker. You can still shell out to ld.lld in zig ld (as I said). |
Oh, sorry, I misunderstood your earlier comments. Are we sure that a single |
From the issue:
|
These are internal, intentionally not part of the publicly documented CLI. Please see #8755 |
This PR adds documentation for the
ld.lld
,lld-link
, andwasm-ld
options, which are currently exposed but not documented.Note that I haven't tested this locally but it should work fine regardless since it only adds a few lines to the help string.