Skip to content

Mostly fix metadata_only backend and extract some code out of rustc_codegen_llvm #51590

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

Merged
merged 19 commits into from
Jul 8, 2018

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Jun 16, 2018

Removes dependency on the ar crate and removes the llvm.enabled config option in favour of setting rust.codegen-backends to [].

@rust-highfive
Copy link
Contributor

r? @cramertj

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 16, 2018
**This is suitable for dev purposes only**",
backend_name, sysroot.display());
early_warn(ErrorOutputType::default(), &warn);
return rustc_codegen_utils::codegen_backend::MetadataOnlyCodegenBackend::new;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a reliable way to pass -Zcodegen-backend=metadata-only to stage1+, but not the bootstrap compiler.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it RUSTFLAGS_STAGE_NOT_0?

@@ -0,0 +1,112 @@
use rustc::session::Session;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to rustc_codegen_utils, because MetadataOnlyCodegenBackend needs to pass them to target_features_whitelist to compile core.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a good direction - LLVM shouldn't be treated that special. Is there a way to make core not contain a usage core::arch if the target features are missing?

Copy link
Contributor

@gnzlbg gnzlbg Jun 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eddyb what do you mean here with "if the target features are missing"? Because of run-time feature detection, core::arch always need to be available.

I don't think this is a good direction - LLVM shouldn't be treated that special

Once we add cranelift as a backend we'll need to map Rust's feature names to backend names (once for LLVM, once for Cranelift), and all backends won't support all targets. So I think that at least the white-lists are going to need to exist on a per backend basis.

let buf: OwningRef<Vec<u8>, [u8]> = OwningRef::new(buf).into();
return Ok(rustc_erase_owner!(buf.map_owner_box()));
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It couldn't load all metadata produced by rustc_codegen_llvm anyway, because it didn't support dylibs.

@@ -81,96 +76,27 @@ pub trait CodegenBackend {
) -> Result<(), CompileIncomplete>;
}

pub struct DummyCodegenBackend;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't used anywere

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not even in librustc_driver/test.rs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

@@ -79,6 +79,7 @@ use rustc::ty::{self, TyCtxt};
use rustc::util::nodemap::{FxHashSet, FxHashMap};
use rustc_mir::monomorphize;
use rustc_codegen_utils::codegen_backend::CodegenBackend;
use rustc_codegen_utils::time_graph;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to rustc_codegen_utils, because it is useful for other future backends too.

@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

[00:04:31] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:31] tidy error: /checkout/src/librustc_codegen_utils/llvm_target_features.rs: incorrect license
[00:04:33] some tidy checks failed
[00:04:33] 
[00:04:33] 
[00:04:33] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:33] 
[00:04:33] 
[00:04:33] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:33] Build completed unsuccessfully in 0:01:44
[00:04:33] Build completed unsuccessfully in 0:01:44
[00:04:33] Makefile:79: recipe for target 'tidy' failed
[00:04:33] make: *** [tidy] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:2763baef
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:0e339b4c:start=1529143037664031161,finish=1529143037672207796,duration=8176635
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:098e0509
$ head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
head: cannot open ‘./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers’ for reading: No such file or directory
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:140f6770
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bjorn3 bjorn3 force-pushed the codegen_llvm_extract branch from 54a7f98 to d77bf58 Compare June 16, 2018 10:11
@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:start:test_run-make-fulldeps
Check compiletest suite=run-make-fulldeps mode=run-make (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:23:37] 
[01:23:37] running 186 tests
[01:24:19] ....................i......................................F........................................
[01:25:10] .....................................................................................test [run-make] run-make-fulldeps/long-linker-command-lines has been running for over 60 seconds
6_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib:" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend  some_crate.rs --crate-name some_crate --crate-type bin -o /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend/some_crate \
[01:26:24]  -Z codegen-backend=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend/the_backend.dylib -Z unstable-options
[01:26:24] Makefile:4: recipe for target 'all' failed
[01:26:24] make[1]: Leaving directory '/checkout/src/test/run-make-fulldeps/hotplug_codegen_backend'
[01:26:24] ------------------------------------------
[01:26:24] stderr:
[01:26:24] ------------------------------------------
[01:26:24] ------------------------------------------
[01:26:24] warning: ignoring --out-dir flag due to -o flag
[01:26:24] 
[01:26:24] warning: ignoring --out-dir flag due to -o flag
[01:26:24] error[E0463]: can't find crate for `std`
[01:26:24] 
[01:26:24] error: aborting due to previous error
[01:26:24] 
[01:26:24] 
[01:26:24] For more information about this error, try `rustc --explain E0463`.
[01:26:24] make[1]: *** [all] Error 101
[01:26:24] ------------------------------------------
[01:26:24] 
[01:26:24] 
[01:26:24] thre" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "cc" "--cxx" "c++" "--cflags" "-ffunction-sections -fdata-sections -fPIC -m64" "--llvm-components" "aarch64 aarch64asmparser aarch64asmprinter aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils all all-targets amdgpu amdgpuasmparser amdgpuasmprinter amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armasmprinter armcodegen armdesc armdisassembler arminfo asmparser asmprinter bitreader bitwriter bpf bpfasmprinter bpfcodegen bpfdesc bpfinfo codegen core coverage debuginfocodeview debuginfodwarf debuginfopdb engine executionengine globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser mips mipsasmparser mipsasmprinter mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmprinter msp430codegen msp430desc msp430info native nativecodegen nvptx nvptxasmprinter nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes powerpc powerpcasmparser powerpcasmprinter powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata runtimedyld scalaropts selectiondag sparc sparcasmparser sparcasmprinter sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzasmprinter systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target transformutils vectorize x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler x86info x86utils xcore xcoreasmprinte4682416 .
3405216 ./obj/build
2641796 ./obj/build/x86_64-unknown-linux-gnu
810212 ./obj/build/x86_64-unknown-linux-gnu/test
728792 ./src
---
149120 ./src/llvm-emscripten/test
146272 ./.git/modules
146268 ./.git/modules/src
123372 ./obj/build/bootstrap/debug/incremental/bootstrap-1r3bppl29tbrj
123368 ./obj/build/bootstrap/debug/incremental/bootstrap-1r3bppl29tbrj/s-f21b4ybsdm-1d7w2n-34nhbs5zu1g0h

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

Copy link
Member

@Mark-Simulacrum Mark-Simulacrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rustbuild changes look acceptable; could you add a comment to config.toml.example about disabling LLVM via the codegen-backends array?

@@ -640,7 +642,9 @@ impl Step for CodegenBackend {
.arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml"));
rustc_cargo_env(builder, &mut cargo);

features += &build_codegen_backend(&builder, &mut cargo, &compiler, target, backend);
if !backend.is_empty() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably not the check you wanted -- we shouldn't be creating CodegenBackend with an empty string. I think we can probably just remove this if.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly do you mean?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backend here isn't an array, but a Interned<String> -- this check should be removed.

@@ -715,7 +714,7 @@ pub fn codegen_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
rx: mpsc::Receiver<Box<Any + Send>>)
-> OngoingCodegen {

check_for_rustc_errors_attr(tcx);
::rustc_codegen_utils::check_for_rustc_errors_attr(tcx);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the advantage to not importing this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing

@Mark-Simulacrum
Copy link
Member

r? @eddyb

@rust-highfive rust-highfive assigned eddyb and unassigned cramertj Jun 16, 2018
@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:start:test_run-make-fulldeps
Check compiletest suite=run-make-fulldeps mode=run-make (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:29:11] 
[01:29:11] running 186 tests
[01:29:56] ....................i..................................F............................................
[01:30:47] .....................................................................................test [run-make] run-make-fulldeps/long-linker-command-lines has been running for over 60 seconds
g_codegen_backend:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib:" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend  some_crate.rs --crate-name some_crate --crate-type bin -o /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend/some_crate \
[01:31:52]  -Z codegen-backend=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend/the_backend.dylib -Z unstable-options
[01:31:52] Makefile:4: recipe for target 'all' failed
[01:31:52] make[1]: Leaving directory '/checkout/src/test/run-make-fulldeps/hotplug_codegen_backend'
[01:31:52] ------------------------------------------
[01:31:52] stderr:
[01:31:52] ------------------------------------------
[01:31:52] ------------------------------------------
[01:31:52] warning: ignoring --out-dir flag due to -o flag
[01:31:52] 
[01:31:52] warning: ignoring --out-dir flag due to -o flag
[01:31:52] error[E0463]: can't find crate for `std`
[01:31:52] 
[01:31:52] error: aborting due to previous error
[01:31:52] 
[01:31:52] 
[01:31:52] For more information about this error, try `rustc --explain E0463`.
[01:31:52] make[1]: *** [all] Error 101

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bjorn3 bjorn3 changed the title Mostyle fix metadata_only backend and extract some code out of rustc_codegen_llvm Mostly fix metadata_only backend and extract some code out of rustc_codegen_llvm Jun 16, 2018
@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:start:test_run-make-fulldeps
Check compiletest suite=run-make-fulldeps mode=run-make (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:34:22] 
[01:34:22] running 186 tests
[01:35:11] ....................i..................................F............................................
[01:36:01] .....................................................................................test [run-make] run-make-fulldeps/long-linker-command-lines has been running for over 60 seconds
[01:37:11] failures:
[01:37:11] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[01:37:11] 
[01:37:11] ---- [run-make] run-make-fulldeps/hotplug_codegen_backend stdout ----
[01:37:11] ---- [run-make] run-make-fulldeps/hotplug_codegen_backend stdout ----
[01:37:11] 
[01:37:11] error: make failed
[01:37:11] status: exit code: 2
[01:37:11] command: "make"
[01:37:11] stdout:
[01:37:11] ------------------------------------------
[01:37:11] make[1]: Entering directory '/checkout/src/test/run-make-fulldeps/hotplug_codegen_backend'
[01:37:11] /bin/echo || exit 0 # This test requires /bin/echo to exist
[01:37:11] 
[01:37:11] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib:" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend  the_backend.rs --crate-name the_backend --crate-type dylib \
[01:37:11]  -o /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend/the_backend.dylib
[01:37:11] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplu" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "cc" "--cxx" "c++" "--cflags" "-ffunction-sections -fdata-sections -fPIC -m64" "--llvm-components" "aarch64 aarch64asmparser aarch64asmprinter aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils all all-targets amdgpu amdgpuasmparser amdgpuasmprinter amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armasmprinter armcodegen armdesc armdisassembler arminfo asmparser asmprinter bitreader bitwriter bpf bpfasmprinter bpfcodegen bpfdesc bpfinfo codegen core coverage debuginfocodeview debuginfodwarf debuginfopdb engine executionengine globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser mips mipsasmparser mipsasmprinter mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmprinter msp430codegen msp430desc msp430info native nativecodegen nvptx nvptxasmprinter nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes powerpc powerpcasmparser powerpcasmprinter powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata runtimedyld scalaropts selectiondag sparc sparcasmparser sparcasmprinter sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzasmprinter systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target transformutils vectorize x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler x86info x86utils xcore xcoreasmprinter xcorecodegen xcoredesc xcoredisassembler xcoreinfo" "--llvm-cxxflags" "-I/usr/lib/llvm-3.9/include -std=c++0x -gsplit-dwarf -Wl,-fuse-ld=gold -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -std=c++11 -ffunction-sections -fdata-sections -O2 -g -DNDEBUG  -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" "--ar" "ar" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:37:11] 
[01:37:11] 
[01:37:11] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:37:11] Build completed unsuccessfully in 0:49:24
[01:37:11] Build completed unsuccessfully in 0:49:24
[01:37:11] make: *** [check] Error 1
[01:37:11] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:03f2c940
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bjorn3
Copy link
Member Author

bjorn3 commented Jun 18, 2018

Why is it failing?

Edit: hopefully fixed it.

@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:start:test_run-make-fulldeps
Check compiletest suite=run-make-fulldeps mode=run-make (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:33:19] 
[01:33:19] running 186 tests
[01:34:07] ....................i..................................F............................................
[01:34:57] .....................................................................................test [run-make] run-make-fulldeps/long-linker-command-lines has been running for over 60 seconds
[01:36:05] failures:
[01:36:05] 
[01:36:05] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[01:36:05] ---- [run-make] run-make-fulldeps/hotplug_codegen_backend stdout ----
[01:36:05] ---- [run-make] run-make-fulldeps/hotplug_codegen_backend stdout ----
[01:36:05] 
[01:36:05] error: make failed
[01:36:05] status: exit code: 2
[01:36:05] command: "make"
[01:36:05] stdout:
[01:36:05] ------------------------------------------
[01:36:05] make[1]: Entering directory '/checkout/src/test/run-make-fulldeps/hotplug_codegen_backend'
[01:36:05] /bin/echo || exit 0 # This test requires /bin/echo to exist
[01:36:05] 
[01:36:05] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib:" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend  the_backend.rs --crate-name the_backend --crate-type dylib \
[01:36:05]  -o /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend/the_backend.dylib
[01:36:05] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib:" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend  some_crate.rs --crate-name some_crate --crate-type bin -o /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend/some_crate \
[01:36:05]  -Z codegen-backend=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend/the_backend.dylib -Z unstable-options
[01:36:05] Makefile:4: recipe for target 'all' failed
[01:36:05] make[1]: Leaving directory '/checkout/src/test/run-make-fulldeps/hotplug_codegen_backend'
[01:36:05] ------------------------------------------
[01:36:05] stderr:
[01:36:05] ------------------------------------------
[01:36:05] ------------------------------------------
[01:36:05] warning: ignoring --out-dir flag due to -o flag
[01:36:05] 
[01:36:05] warning: ignoring --out-dir flag due to -o flag
[01:36:05] error[E0463]: can't find crate for `std`
[01:36:05] 
[01:36:05] error: aborting due to previous error
[01:36:05] 
[01:36:05] 
[01:36:05] For more information about this error, try `rustc --explain E0463`.
[01:36:05] make[1]: *** [all] Error 101
[01:36:05] ------------------------------------------
[01:36:05] 
[01:36:05] 
[01:36:05] thread '[run-make] run-make-fulldeps/hotplug_codegen_backend' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[01:36:05] 
[01:36:05] 
[01:36:05] failures:
[01:36:05]     [run-make] run-make-fulldeps/hotplug_codegen_backend
[01:36:05]     [run-make] run-make-fulldeps/hotplug_codegen_backend
[01:36:05] 
[01:36:05] test result: FAILED. 184 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out
[01:36:05] 
[01:36:05] 
[01:36:05] 
[01:36:05] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--rustdoc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "--src-base" "/checkout/src/test/run-make-fulldeps" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-make" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "cc" "--cxx" "c++" "--cflags" "-ffunction-sections -fdata-sections -fPIC -m64" "--llvm-components" "aarch64 aarch64asmparser aarch64asmprinter aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils all all-targets amdgpu amdgpuasmparser amdgpuasmprinter amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armasmprinter armcodegen armdesc armdisassembler arminfo asmparser asmprinter bitreader bitwriter bpf bpfasmprinter bpfcodegen bpfdesc bpfinfo codegen core coverage debuginfocodeview debuginfodwarf debuginfopdb engine executionengine globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser mips mipsasmparser mipsasmprinter mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmprinter msp430codegen msp430desc msp430info native nativecodegen nvptx nvptxasmprinter nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes powerpc powerpcasmparser powerpcasmprinter powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata runtimedyld scalaropts selectiondag sparc sparcasmparser sparcasmprinter sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzasmprinter systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target transformutils vectorize x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler x86info x86utils xcore xcoreasmprinter xcorecodegen xcoredesc xcoredisassembler xcoreinfo" "--llvm-cxxflags" "-I/usr/lib/llvm-3.9/include -std=c++0x -gsplit-dwarf -Wl,-fuse-ld=gold -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Werror=date-time -std=c++11 -ffunction-sections -fdata-sections -O2 -g -DNDEBUG  -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" "--ar" "ar" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:36:05] 
[01:36:05] 
[01:36:05] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:36:05] Build completed unsuccessfully in 0:48:48
[01:36:05] Build completed unsuccessfully in 0:48:48
[01:36:05] make: *** [check] Error 1
[01:36:05] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1328307e
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:3223134c:start=1529344319606126779,finish=1529344319615321779,duration=9195000
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:049417b6
$ head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
head: cannot open ‘./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers’ for reading: No such file or directory
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:13b0a7fa
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bjorn3
Copy link
Member Author

bjorn3 commented Jun 18, 2018

Still not fixed :(

@bjorn3
Copy link
Member Author

bjorn3 commented Jun 19, 2018

Fixed :)

@bjorn3 bjorn3 force-pushed the codegen_llvm_extract branch 2 times, most recently from 219d2b2 to fb804ad Compare June 19, 2018 17:02
@bjorn3
Copy link
Member Author

bjorn3 commented Jun 19, 2018

Squashed the commits to fix the test

@@ -225,7 +161,7 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
collector::MonoItemCollectionMode::Eager
).0.iter()
);
::rustc::middle::dependency_format::calculate(tcx);
//::rustc::middle::dependency_format::calculate(tcx);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented out code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crashes atm.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a FIXME

# make this an empty array (but that probably won't get too far in the
# bootstrap)
# make this an empty array (that will disable LLVM, but bootstrap will fail at
# the time the final rustc binary is built for stage 1)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right stage? I always get confused about it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs to be that explicit, keeping the original "but that probably won't get too far in the bootstrap" and just adding "which will disable LLVM" before it seems enough.

@eddyb
Copy link
Member

eddyb commented Jun 22, 2018

cc @alexcrichton on the rustbuild/LLVM changes

@@ -448,3 +448,101 @@ pub fn ty_fn_sig<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
_ => bug!("unexpected type {:?} to ty_fn_sig", ty)
}
}

pub fn size_and_align_of_dst<'a, 'tcx>(bx: &Builder<'a, 'tcx>, t: Ty<'tcx>, info: ValueRef)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why move this? I'd rather see base and common go away just as much as glue, so moving something here doesn't seem that useful. IMO this should be a method on PlaceRef, that's just size_and_align_of.

let header = Header::new("rust.metadata.bin".to_string(), metadata.len() as u64);
builder.append(&header, Cursor::new(metadata)).unwrap();
let mut file = File::create(&output_name).unwrap();
file.write_all(metadata).unwrap();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So all library types are effectively the same as --emit=metadata?

Copy link
Member Author

@bjorn3 bjorn3 Jun 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the metadata-only backend yes, except for dylibs, because these must have compressed metadata.

@@ -2110,7 +2110,6 @@ dependencies = [
name = "rustc_codegen_utils"
version = "0.0.0"
dependencies = [
"ar 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does something else depend on this crate?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was asking because there's a "checksum" line that would also be removed if this was the last use of ar.
I just checked and rustc_driver also depends on ar.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what??? how did tidy pass then? i removed ar as whitelisted dep

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unused dep


use rustc_data_structures::owning_ref::OwningRef;
use rustc_data_structures::sync::Lrc;
use ar::{Archive, Builder, Header};
use flate2::Compression;
use flate2::write::DeflateEncoder;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is flate2 used for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compressing the metadata, when rustc_metadata expects it.

@eddyb
Copy link
Member

eddyb commented Jun 22, 2018

In general I dislike rustc_codegen_utils and would prefer if its parts were moved into rustc_driver (i.e. the CodegenBackend trait specifically), rustc_mir (if at all applicable), or somewhere in rustc.

@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
######################################################################## 100.0%
[00:01:06] extracting /checkout/obj/build/cache/2018-05-10/cargo-beta-x86_64-unknown-linux-gnu.tar.gz
[00:01:06]     Updating registry `https://github.com/rust-lang/crates.io-index`
[00:01:25]     Updating git repository `https://github.com/rust-lang-nursery/rustfmt`
[00:01:27] error: the lock file needs to be updated but --locked was passed to prevent this
[00:01:27] failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml --locked
[00:01:27] Build completed unsuccessfully in 0:00:37
[00:01:27] Makefile:81: recipe for target 'prepare' failed
[00:01:27] make: *** [prepare] Error 1
[00:01:28] Command failed. Attempt 2/5:
[00:01:29] error: the lock file needs to be updated but --locked was passed to prevent this
[00:01:29] failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml --locked
[00:01:29] Build completed unsuccessfully in 0:00:00
[00:01:29] Makefile:81: recipe for target 'prepare' failed
[00:01:29] make: *** [prepare] Error 1
[00:01:31] Command failed. Attempt 3/5:
[00:01:31] error: the lock file needs to be updated but --locked was passed to prevent this
[00:01:31] failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml --locked
[00:01:31] Build completed unsuccessfully in 0:00:00
[00:01:31] Makefile:81: recipe for target 'prepare' failed
[00:01:31] make: *** [prepare] Error 1
[00:01:34] Command failed. Attempt 4/5:
[00:01:34] error: the lock file needs to be updated but --locked was passed to prevent this
[00:01:34] failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml --locked
[00:01:34] Build completed unsuccessfully in 0:00:00
[00:01:34] Makefile:81: recipe for target 'prepare' failed
[00:01:34] make: *** [prepare] Error 1
[00:01:38] Command failed. Attempt 5/5:
[00:01:38] error: the lock file needs to be updated but --locked was passed to prevent this
[00:01:38] failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml --locked
[00:01:38] Build completed unsuccessfully in 0:00:00
[00:01:38] Makefile:81: recipe for target 'prepare' failed
[00:01:38] make: *** [prepare] Error 1
[00:01:38] The command has failed after 5 attempts.

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 1.
travis_time:start:050bcab9
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:0d422055:start=1529671229709549546,finish=1529671229715767977,duration=6218431
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0045a001
$ head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
head: cannot open ‘./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers’ for reading: No such file or directory
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:09a8c03d
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bjorn3 bjorn3 force-pushed the codegen_llvm_extract branch from 1148253 to ff12beb Compare July 7, 2018 08:56
@bjorn3
Copy link
Member Author

bjorn3 commented Jul 7, 2018

Rebased

@rust-highfive

This comment has been minimized.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Collaborator

bors commented Jul 7, 2018

📌 Commit 23c0b3b has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 7, 2018
@bors
Copy link
Collaborator

bors commented Jul 8, 2018

⌛ Testing commit 23c0b3b with merge 9342f29...

bors added a commit that referenced this pull request Jul 8, 2018
Mostly fix metadata_only backend and extract some code out of rustc_codegen_llvm

Removes dependency on the `ar` crate and removes the `llvm.enabled` config option in favour of setting `rust.codegen-backends` to `[]`.
@bors
Copy link
Collaborator

bors commented Jul 8, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 9342f29 to master...

@bors bors merged commit 23c0b3b into rust-lang:master Jul 8, 2018
@bjorn3 bjorn3 deleted the codegen_llvm_extract branch July 8, 2018 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.