Skip to content

fix: remove "rust-lld" as custom linker on windows#5242

Open
alex-ds13 wants to merge 1 commit intoDioxusLabs:mainfrom
alex-ds13:windows-fix-rust-lld
Open

fix: remove "rust-lld" as custom linker on windows#5242
alex-ds13 wants to merge 1 commit intoDioxusLabs:mainfrom
alex-ds13:windows-fix-rust-lld

Conversation

@alex-ds13
Copy link

While porting some of the windows fixes into cargo-hot (this PR), I discovered and fixed another issue on windows that also exists on dioxus cli.

The issue is that the lld packed by rust by default as rust-lld.exe on windows needs a -flavor flag to tell it which flavor to use. When executing cargo normally it seems to be passing a Z linker-flavor=link to rustc which ends up calling "rust-lld.exe" with the proper flavor, that is it calls rust-lld.exe -flavor link.

We could do the same here and add the -flavor link to the "rust-lld.exe" command on Windows when we detect that the user is using the "rust-lld" linker. However I believe that is just some unnecessary complexity, since we already use the lld version packed by rust on windows by default, we can simply set custom_linker to None when the user is using "rust-lld" as linker. And then it will behave properly.

Also, I've used cfg!(windows) instead of checking for BundleFormat::Windows, since from what I understood the BundleFormat is related to the target you are building and not the system you are currently using, but if you think there is a better way to do this, let me know!

Also let me know if you think this should be fixed in another manner, like passing the flavor flag to the custom linker.

Fixes #4694

@alex-ds13 alex-ds13 requested a review from a team as a code owner January 19, 2026 17:36
- Since we already use the lld version packed by rust on windows by
  default, we can simply set custom_linker to `None` when the user is
  using "rust-lld" as linker.
@alex-ds13 alex-ds13 force-pushed the windows-fix-rust-lld branch from fa44c30 to e5e1817 Compare January 19, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dx serve --hot-patch fails on Windows with linker = "rust-lld.exe" set

1 participant