Skip to content
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

Use command line metadata path if provided #85362

Merged
merged 2 commits into from
May 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions compiler/rustc_session/src/output.rs
Original file line number Diff line number Diff line change
@@ -127,6 +127,11 @@ pub fn filename_for_metadata(
crate_name: &str,
outputs: &OutputFilenames,
) -> PathBuf {
// If the command-line specified the path, use that directly.
if let Some(Some(out_filename)) = sess.opts.output_types.get(&OutputType::Metadata) {
return out_filename.clone();
}

let libname = format!("{}{}", crate_name, sess.opts.cg.extra_filename);

let out_filename = outputs
33 changes: 33 additions & 0 deletions src/test/run-make/emit-named-files/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-include ../../run-make-fulldeps/tools.mk

OUT=$(TMPDIR)/emit

all: asm llvm-bc llvm-ir obj metadata link dep-info mir

asm: $(OUT)
$(RUSTC) --emit asm=$(OUT)/libfoo.s foo.rs
test -f $(OUT)/libfoo.s
llvm-bc: $(OUT)
$(RUSTC) --emit llvm-bc=$(OUT)/libfoo.bc foo.rs
test -f $(OUT)/libfoo.bc
llvm-ir: $(OUT)
$(RUSTC) --emit llvm-ir=$(OUT)/libfoo.ll foo.rs
test -f $(OUT)/libfoo.ll
obj: $(OUT)
$(RUSTC) --emit obj=$(OUT)/libfoo.o foo.rs
test -f $(OUT)/libfoo.o
metadata: $(OUT)
$(RUSTC) --emit metadata=$(OUT)/libfoo.rmeta foo.rs
test -f $(OUT)/libfoo.rmeta
link: $(OUT)
$(RUSTC) --emit link=$(OUT)/libfoo.rlib foo.rs
test -f $(OUT)/libfoo.rlib
dep-info: $(OUT)
$(RUSTC) --emit dep-info=$(OUT)/libfoo.d foo.rs
test -f $(OUT)/libfoo.d
mir: $(OUT)
$(RUSTC) --emit mir=$(OUT)/libfoo.mir foo.rs
test -f $(OUT)/libfoo.mir

$(OUT):
mkdir -p $(OUT)
1 change: 1 addition & 0 deletions src/test/run-make/emit-named-files/foo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#![crate_type = "rlib"]