Return .efi extension for EFI executable#104158
Conversation
Originally part of rust-lang#100316 Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
|
(rustbot has picked a reviewer for you, use r? to override) |
dvdhrm
left a comment
There was a problem hiding this comment.
The uefi targets already contain exe_suffix = ".efi", so this syncs up nicely. Looks good!
| format!("{}.efi", name) | ||
| } else { | ||
| name.to_string() | ||
| } |
There was a problem hiding this comment.
An option would be to use the output of rustc --print file-names --crate-name {name} --crate-type bin, but that might be a cyclic dependency if this function is used to find the path to the rustc executable. See for example https://github.com/bjorn3/rustc_codegen_cranelift/blob/0b37af8c6168f11221ba74115eb3c5725fd13c3c/build_system/rustc_info.rs#L46-L74
There was a problem hiding this comment.
From what I see, this function is used with a lot of binaries instead of crates, so I don't think rustc --print file-names --crate-name {name} --crate-type bin can be used at all places where exe is currently being used.
There was a problem hiding this comment.
Yeah, if the binary name contains a -, it won't work. Cargo uses ____ as crate name once and then replaces the ____ in the output with the binary name every time. That should work I think.
There was a problem hiding this comment.
This feels a bit awkward regarding cyclic dependencies, doesn't it? Even if you fetch a stage from an external source, this stage will not reflect the last build, so this function will be out-of-sync with the source it builds. Not necessarily a big issue, but maybe requires a bit more investigation. Not sure it is worth blocking this change on it?
There was a problem hiding this comment.
Ideally you should ask the rustc binary that actually does the compilation for the artifact of which you want the filename. I do agree that it isn't worth blocking this change on.
|
@bors r+ rollup |
…earth Rollup of 9 pull requests Successful merges: - rust-lang#103709 (ci: Upgrade dist-x86_64-netbsd to NetBSD 9.0) - rust-lang#103744 (Upgrade cc for working is_flag_supported on cross-compiles) - rust-lang#104105 (llvm: dwo only emitted when object code emitted) - rust-lang#104158 (Return .efi extension for EFI executable) - rust-lang#104181 (Add a few known-bug tests) - rust-lang#104266 (Regression test for coercion of mut-ref to dyn-star) - rust-lang#104300 (Document `Path::parent` behavior around relative paths) - rust-lang#104304 (Enable profiler in dist-s390x-linux) - rust-lang#104362 (Add `delay_span_bug` to `AttrWrapper::take_for_recovery`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Originally part of #100316
Signed-off-by: Ayush Singh ayushsingh1325@gmail.com