MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / pipeline_for

Method pipeline_for

src/build.rs:403–422  ·  view source on GitHub ↗
(manifest: &BuildManifest)

Source from the content-addressed store, hash-verified

401
402 /// Drop stdlib objects no kept object references (directly or transitively).
403 /// Program/extra objects and any object defining an entry symbol are roots.
404 fn prune_unreferenced_stdlib(
405 units: Vec<BuiltUnit>,
406 prunable: &std::collections::HashSet<String>,
407 entry: Option<&str>,
408 ) -> Vec<BuiltUnit> {
409 let entry_roots = ["_start", "_kernel_start"];
410 let is_root = |unit: &BuiltUnit| {
411 !prunable.contains(&unit.name)
412 || unit.assembled.global_symbol_names().any(|symbol| {
413 entry_roots.contains(&symbol) || entry.is_some_and(|entry| entry == symbol)
414 })
415 };
416 let mut kept: Vec<bool> = units.iter().map(is_root).collect();
417 let mut needed: std::collections::HashSet<String> = units
418 .iter()
419 .zip(&kept)
420 .filter(|(_, keep)| **keep)
421 .flat_map(|(unit, _)| unit.assembled.undefined_symbol_names())
422 .map(str::to_owned)
423 .collect();
424 loop {
425 let mut changed = false;

Callers

nothing calls this directly

Calls 11

get_stdlib_type_preludeFunction · 0.85
set_entry_pointMethod · 0.80
set_link_layoutMethod · 0.80
set_write_artifactsMethod · 0.80
set_string_prefixMethod · 0.80
set_source_preludeMethod · 0.80
set_module_resolverMethod · 0.80
set_target_modeMethod · 0.45
cloneMethod · 0.45
set_type_preludeMethod · 0.45

Tested by

no test coverage detected