Skip to content

zig ld: a drop-in linker replacement #8755

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

Open
andrewrk opened this issue May 12, 2021 · 5 comments
Open

zig ld: a drop-in linker replacement #8755

andrewrk opened this issue May 12, 2021 · 5 comments
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. linking
Milestone

Comments

@andrewrk
Copy link
Member

Now that there is significant work put into Mach-O linking thanks to @kubkon, Zig is more than just a linker driver for LLD. It is now a linker that competes in the linker space, and some projects may want to use Zig as a drop-in replacement for other linkers.

This issue is to formalize that by adding an "ld" subcommand to Zig's CLI.

This issue does not block 1.0.

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. linking labels May 12, 2021
@andrewrk andrewrk added this to the 1.1.0 milestone May 12, 2021
@SaptakBhoumik
Copy link

Hi @andrewrk , is zig's linker better at link time optimization?

@kubkon
Copy link
Member

kubkon commented May 9, 2022

Hi @andrewrk , is zig's linker better at link time optimization?

I can speak for the MachO linker which is now fully self-hosted (written in Zig): we currently do not offer support for LLVM's LTO (if that's what you mean that is). LLVM forces a client linker to link dynamically to LTO plugin module which I am strongly against given that we already ship statically linked LLVM. I already started a conversation with LLVM maintainers about it a while back, but didn't see it through as other stuff came up. I will need to follow it up although this is not our priority right now.

@SaptakBhoumik
Copy link

Hi @andrewrk , is zig's linker better at link time optimization?

I can speak for the MachO linker which is now fully self-hosted (written in Zig): we currently do not offer support for LLVM's LTO (if that's what you mean that is). LLVM forces a client linker to link dynamically to LTO plugin module which I am strongly against given that we already ship statically linked LLVM. I already started a conversation with LLVM maintainers about it a while back, but didn't see it through as other stuff came up. I will need to follow it up although this is not our priority right now.

Hmm I see. Thank for your answer:)

@initdc
Copy link

initdc commented Oct 29, 2022

Looking forward to this feature!

And you can try this my rust template to get some unsupported linker flags.

@absolutelynothinghere
Copy link

If possible, please also add nm, objdump, strip, and other LLVM commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. linking
Projects
None yet
Development

No branches or pull requests

5 participants