Compile the stdlib for `mode` as independent per-module objects (no source concatenation), to link alongside the user program. Kernel gets its prefix.
(
mode: TargetMode,
)
| 1237 | -> Result<Vec<(String, AssembledOutput)>, CompilationError> { |
| 1238 | let mut pipeline = CompilationPipeline::new(); |
| 1239 | pipeline.set_target_mode(TargetMode::Kernel); |
| 1240 | pipeline.set_write_artifacts(false); |
| 1241 | pipeline.set_type_prelude(hll_to_ir::stdlib::get_stdlib_type_prelude()); |
| 1242 | pipeline.set_string_prefix(Some("__kern_str_".to_owned())); |
| 1243 | pipeline.set_module_mangling(false); |
| 1244 | pipeline.set_current_source_path(bundled_module_path("my_kernel")); |
| 1245 | pipeline.compile_program_closure("my_kernel", os_runtime::kernel::MY_KERNEL) |
| 1246 | } |
| 1247 | } |
| 1248 | |
| 1249 | /// Bundled HLL modules addressable by `import("name")` in host builds. |
| 1250 | pub fn bundled_module_source(name: &str) -> Option<&'static str> { |
| 1251 | os_runtime::module_source(name).or_else(|| crate::userspace::module_source(name)) |
| 1252 | } |
| 1253 | |
| 1254 | // Repo-relative source path of a bundled module, mirroring `bundled_module_source`. |
| 1255 | fn bundled_module_path(name: &str) -> Option<&'static str> { |
| 1256 | os_runtime::module_path(name).or_else(|| crate::userspace::module_path(name)) |
| 1257 | } |
| 1258 | |
| 1259 | fn module_member_aliases( |
| 1260 | alias: &str, |
| 1261 | key: &str, |
| 1262 | exports: &std::collections::HashSet<String>, |
| 1263 | ) -> std::collections::HashMap<String, String> { |
nothing calls this directly
no test coverage detected