-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustc_target: support Unix-flavor linkers for UEFI #110869
Conversation
r? @TaKO8Ki (rustbot has picked a reviewer for you, use r? to override) |
These commits modify compiler targets. |
The job Click to see the possible cause of the failure (guessed by this bot)
|
In the test that's failing:
Can we not add linker arguments for non-default linkers? |
This needs some context. UEFI uses PE/COFF binary format, right? @rustbot author |
No, I'd like to use ld.lld, which can also produce COFF. The reason for specifically using the ld interface of lld is as follows: in Nixpkgs, cc is a wrapper script around the actual C compiler, which in this case is clang. The wrapper script is there so that we can set up the compiler with our library search paths and so on. Compiler wrappers like this are very common among package collections — I'm somewhat familiar with pkgsrc and Homebrew, both of which also use compiler wrappers. Our compiler wrapper was written for Unix compilers and linkers, so it understands Unix-flavor flags, but not the Windows-style ones rustc uses by default for UEFI targets. But since rustc supports choosing the linker flavor, the best way for us to add support to our toolchain for building UEFI binaries with Rust is to tell it to use the Unix-flavor arguments. This works fine with these small changes to teach rustc how to handle the UEFI specifics for Unix-flavor linkers. |
Ok, I see. I suggest adding new UEFI targets As a bonus they will be able to use mingw toolchain for linking for UEFI too (if it works at all). |
Using Given that RISCV-on-PE is still not supported by LLVM, there might be people working to resurrect the I don't have a better idea, though. Sorry. Preferably, we would be able to detect the argument-style of lld at runtime and keep a single target. |
@alyssais any updates on this? thanks |
Closing this as inactive. Feel free to reöpen this pr or create a new pr if you get the time to work on this. Thanks |
No description provided.