-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
assertion failed: !are_upstream_rust_objects_already_included(sess) when building rustc_private with monolithic lto #45689
Comments
Alright, the reproduce was shorter than I expected: cargo new --bin crashtest
cd crashtest
echo "
[profile.release]
lto = true
" >> Cargo.toml make src/main.rs this: #![feature(rustc_private)]
extern crate rustc_errors as errors;
fn main() { println!("Hello, world!"); } then
|
For convenience I made this a repo: https://github.com/matthiaskrgr/rustc_crashtest_lto (run cargo build --release on this) |
Still crashing with
|
Had a look at this again.
This is the code causing the assert // Same thing as above, but for dynamic crates instead of static crates.
fn add_dynamic_crate(cmd: &mut Linker, sess: &Session, cratepath: &Path) {
// If we're performing LTO, then it should have been previously required
// that all upstream rust dependencies were available in an rlib format.
assert!(!is_full_lto_enabled(sess));
// Just need to tell the linker about where the library lives and
// what its name is
let parent = cratepath.parent();
if let Some(dir) = parent {
cmd.include_path(&fix_windows_verbatim_for_gcc(dir));
}
let filestem = cratepath.file_stem().unwrap().to_str().unwrap();
cmd.link_rust_dylib(&unlib(&sess.target, filestem),
parent.unwrap_or(Path::new("")));
} The problem might be that by trying to import parts of rustc it is required that we have these parts of rustc compiled as rlib and prepared for the lto which however might not be the case. |
rustc_private tracking issue: #27812 |
The ICE is still happening but the backtrace and assert message slightly changed
|
@matthiaskrgr Does this still reproduce on a current nightly? |
The minimal example works. |
Ok, should we add a test perhaps? |
Yeah, definitely, I'll have a look. :) |
EDIT: repo for reproducing: https://github.com/matthiaskrgr/rustc_crashtest_lto , run cargo build --release
crashes rustc:
The text was updated successfully, but these errors were encountered: