mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Make sure upstream object files are added to staticlibs when compiling
with ThinLTO and cross-lang-lto. Normally, when compiling with whole-crate-graph ThinLTO, we expect rustc's LTO step to "uplift" upstream object files/LLVM modules to the current set of compilation artifacts. Therefore the staticlib creation code skips this uplifting. However, when compiling with "cross-language LTO" (i.e. defer LTO to the actual linker), the LTO step in rustc is not performed, so we have to take care of copying upstream object files during archive creation (like we already do when compiling without any LTO).
This commit is contained in:
@@ -1626,8 +1626,12 @@ fn relevant_lib(sess: &Session, lib: &NativeLibrary) -> bool {
|
||||
fn is_full_lto_enabled(sess: &Session) -> bool {
|
||||
match sess.lto() {
|
||||
Lto::Yes |
|
||||
Lto::Thin |
|
||||
Lto::Fat => true,
|
||||
Lto::Thin => {
|
||||
// If we defer LTO to the linker, we haven't run LTO ourselves, so
|
||||
// any upstream object files have not been copied yet.
|
||||
!sess.opts.debugging_opts.cross_lang_lto.enabled()
|
||||
}
|
||||
Lto::No |
|
||||
Lto::ThinLocal => false,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user