diff options
| author | Daniil Belov <belov.dv@phystech.edu> | 2022-07-19 12:00:28 +0300 |
|---|---|---|
| committer | Daniil Belov <belov.dv@phystech.edu> | 2022-07-26 13:55:27 +0300 |
| commit | 7d4a98e61aef8622ab4fa0cec0810171cf17b1bf (patch) | |
| tree | 5b86a093fccc2504f4fc907569eec38055c9ffc6 /compiler/rustc_codegen_ssa/src/back | |
| parent | 9ed0bf9f2bd63933785fb8a380c177d2d70e88ec (diff) | |
| download | rust-7d4a98e61aef8622ab4fa0cec0810171cf17b1bf.tar.gz rust-7d4a98e61aef8622ab4fa0cec0810171cf17b1bf.zip | |
Lib kind -l link-arg:
arbitrary link argument like -C link-arg, but respecting relative order to other `-l` options, unstable
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/link.rs | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 878a670cba3..663a6f3a277 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -336,6 +336,7 @@ fn link_rlib<'a, B: ArchiveBuilder<'a>>( | NativeLibKind::Dylib { .. } | NativeLibKind::Framework { .. } | NativeLibKind::RawDylib + | NativeLibKind::LinkArg | NativeLibKind::Unspecified => continue, } if let Some(name) = lib.name { @@ -1287,6 +1288,7 @@ fn print_native_static_libs(sess: &Session, all_native_libs: &[NativeLib]) { } // These are included, no need to print them NativeLibKind::Static { bundle: None | Some(true), .. } + | NativeLibKind::LinkArg | NativeLibKind::RawDylib => None, } }) @@ -2225,6 +2227,9 @@ fn add_local_native_libraries( // FIXME(#58713): Proper handling for raw dylibs. bug!("raw_dylib feature not yet implemented"); } + NativeLibKind::LinkArg => { + cmd.arg(name); + } } } } @@ -2362,19 +2367,34 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>( (lib.name, lib.kind, lib.verbatim) }; - if let NativeLibKind::Static { bundle: Some(false), whole_archive } = - lib.kind - { - let verbatim = lib.verbatim.unwrap_or(false); - if whole_archive == Some(true) { + match lib.kind { + NativeLibKind::Static { + bundle: Some(false), + whole_archive: Some(true), + } => { cmd.link_whole_staticlib( name, - verbatim, + lib.verbatim.unwrap_or(false), search_path.get_or_init(|| archive_search_paths(sess)), ); - } else { - cmd.link_staticlib(name, verbatim); } + NativeLibKind::Static { + bundle: Some(false), + whole_archive: Some(false) | None, + } => { + cmd.link_staticlib(name, lib.verbatim.unwrap_or(false)); + } + NativeLibKind::LinkArg => { + cmd.arg(name); + } + NativeLibKind::Dylib { .. } + | NativeLibKind::Framework { .. } + | NativeLibKind::Unspecified + | NativeLibKind::RawDylib => {} + NativeLibKind::Static { + bundle: Some(true) | None, + whole_archive: _, + } => {} } } } @@ -2565,7 +2585,7 @@ fn add_upstream_native_libraries( // already included them in add_local_native_libraries and // add_upstream_rust_crates NativeLibKind::Static { .. } => {} - NativeLibKind::RawDylib => {} + NativeLibKind::RawDylib | NativeLibKind::LinkArg => {} } } } |
