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

Method compile_kernel_modules_with_stdlib

src/compilation_pipeline.rs:1208–1235  ·  view source on GitHub ↗
(
        &mut self,
        kernel_modules: &[(&str, &str)],
        stdlib_object: &AssembledOutput,
    )

Source from the content-addressed store, hash-verified

1206 mode: TargetMode,
1207 ) -> Result<Vec<(String, AssembledOutput)>, CompilationError> {
1208 let mut pipeline = CompilationPipeline::new();
1209 pipeline.set_target_mode(mode);
1210 pipeline.set_write_artifacts(false);
1211 pipeline.set_type_prelude(hll_to_ir::stdlib::get_stdlib_type_prelude());
1212 if mode == TargetMode::Kernel {
1213 pipeline.set_string_prefix(Some("__kern_str_".to_owned()));
1214 }
1215 let modules = hll_to_ir::stdlib::get_stdlib_modules_for_mode(mode);
1216 let mut objects = Vec::with_capacity(modules.len());
1217 for (module_name, source) in &modules {
1218 // Attribute each module to its real source file so stdlib code the
1219 // debugger steps through maps back to workspace lines.
1220 let path = hll_to_ir::stdlib::stdlib_module_source_path(mode, module_name);
1221 pipeline.set_current_source_path(path);
1222 objects.extend(pipeline.compile_modules(&[(*module_name, *source)])?);
1223 }
1224 for object in &mut objects {
1225 mark_all_defined_symbols_global(object);
1226 }
1227 Ok(modules
1228 .iter()
1229 .map(|(name, _)| (*name).to_owned())
1230 .zip(objects)
1231 .collect())
1232 }
1233
1234 /// Compile the kernel modules reachable from `my_kernel` via the qualified-import closure,
1235 /// deps first, as per-module objects. Mangling is off: the kernel links flat.
1236 pub fn compile_kernel_module_objects()
1237 -> Result<Vec<(String, AssembledOutput)>, CompilationError> {
1238 let mut pipeline = CompilationPipeline::new();

Callers

nothing calls this directly

Calls 4

compile_modulesMethod · 0.80
pushMethod · 0.80
collectMethod · 0.80

Tested by

no test coverage detected