(
sess: &Session,
codegen_results: &CodegenResults,
crate_type: CrateType,
)
| 421 | } |
| 422 | |
| 423 | fn add_upstream_native_libraries( |
| 424 | sess: &Session, |
| 425 | codegen_results: &CodegenResults, |
| 426 | crate_type: CrateType, |
| 427 | ) { |
| 428 | let (_, data) = codegen_results |
| 429 | .crate_info |
| 430 | .dependency_formats |
| 431 | .iter() |
| 432 | .find(|(ty, _)| *ty == crate_type) |
| 433 | .expect("failed to find crate type in dependency format list"); |
| 434 | |
| 435 | for &cnum in &codegen_results.crate_info.used_crates { |
| 436 | for lib in codegen_results.crate_info.native_libraries[&cnum].iter() { |
| 437 | if !relevant_lib(sess, lib) { |
| 438 | continue; |
| 439 | } |
| 440 | match lib.kind { |
| 441 | NativeLibKind::Static { |
| 442 | bundle: Some(false), |
| 443 | .. |
| 444 | } if data[cnum.as_usize() - 1] != Linkage::Static => {} |
| 445 | |
| 446 | NativeLibKind::Static { |
| 447 | bundle: None | Some(true), |
| 448 | .. |
| 449 | } => {} |
| 450 | |
| 451 | _ => sess.fatal(format!( |
| 452 | "`NativeLibKind::{:?}` (name={:?}) not supported yet", |
| 453 | lib.kind, lib.name |
| 454 | )), |
| 455 | } |
| 456 | } |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | // FIXME(eddyb) upstream has code like this already, maybe we can reuse most of it? |
| 461 | // (see `compiler/rustc_codegen_ssa/src/back/link.rs`) |
no test coverage detected