linker: Support mixing crates built with different values of -Zpacked_bundled_libs
So you can change the value of `-Zpacked_bundled_libs` without rebuilding standard library
This commit is contained in:
parent
fe7aab13b1
commit
82ecfd4ed6
1 changed files with 7 additions and 9 deletions
|
@ -2283,7 +2283,7 @@ fn add_native_libs_from_crate(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if sess.opts.unstable_opts.packed_bundled_libs && link_static && cnum != LOCAL_CRATE {
|
if link_static && cnum != LOCAL_CRATE && !bundled_libs.is_empty() {
|
||||||
// If rlib contains native libs as archives, unpack them to tmpdir.
|
// If rlib contains native libs as archives, unpack them to tmpdir.
|
||||||
let rlib = &codegen_results.crate_info.used_crate_source[&cnum].rlib.as_ref().unwrap().0;
|
let rlib = &codegen_results.crate_info.used_crate_source[&cnum].rlib.as_ref().unwrap().0;
|
||||||
archive_builder_builder
|
archive_builder_builder
|
||||||
|
@ -2329,9 +2329,9 @@ fn add_native_libs_from_crate(
|
||||||
&& sess.opts.test);
|
&& sess.opts.test);
|
||||||
|
|
||||||
if bundle && cnum != LOCAL_CRATE {
|
if bundle && cnum != LOCAL_CRATE {
|
||||||
if sess.opts.unstable_opts.packed_bundled_libs {
|
if let Some(filename) = lib.filename {
|
||||||
// If rlib contains native libs as archives, they are unpacked to tmpdir.
|
// If rlib contains native libs as archives, they are unpacked to tmpdir.
|
||||||
let path = tmpdir.join(lib.filename.unwrap().as_str());
|
let path = tmpdir.join(filename.as_str());
|
||||||
if whole_archive {
|
if whole_archive {
|
||||||
cmd.link_whole_rlib(&path);
|
cmd.link_whole_rlib(&path);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2464,12 +2464,10 @@ fn add_upstream_rust_crates<'a>(
|
||||||
match linkage {
|
match linkage {
|
||||||
Linkage::Static | Linkage::IncludedFromDylib => {
|
Linkage::Static | Linkage::IncludedFromDylib => {
|
||||||
if link_static_crate {
|
if link_static_crate {
|
||||||
if sess.opts.unstable_opts.packed_bundled_libs {
|
|
||||||
bundled_libs = codegen_results.crate_info.native_libraries[&cnum]
|
bundled_libs = codegen_results.crate_info.native_libraries[&cnum]
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|lib| lib.filename)
|
.filter_map(|lib| lib.filename)
|
||||||
.collect();
|
.collect();
|
||||||
}
|
|
||||||
add_static_crate(
|
add_static_crate(
|
||||||
cmd,
|
cmd,
|
||||||
sess,
|
sess,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue