Compile the kernel stdlib + modules as independent per-module objects (no concatenation).
()
| 149 | ("syscall", kernel::SYSCALL), |
| 150 | ("fs", kernel::FS), |
| 151 | ("trap_entry", kernel::TRAP_ENTRY), |
| 152 | ("trap_handler", kernel::TRAP_HANDLER), |
| 153 | ]); |
| 154 | mods |
| 155 | } |
| 156 | |
| 157 | // Compile the kernel stdlib + modules as independent per-module objects (no concatenation). |
| 158 | fn compiled_stdlib() -> &'static [(String, AssembledOutput)] { |
| 159 | STDLIB_OBJS.get_or_init(|| { |
| 160 | kernel_code_modules() |
| 161 | .iter() |
| 162 | .map(|(name, src)| { |
| 163 | let (source_prelude, module_aliases) = direct_imports(src); |
| 164 | let compiler = HllCompiler::new(CompileConfig { |
| 165 | target: TargetMode::Kernel, |
| 166 | strict: true, |
| 167 | string_prefix: Some("__kern_str_".to_owned()), |
| 168 | type_prelude: get_stdlib_type_prelude(), |
| 169 | source_prelude: Some(source_prelude), |
| 170 | module_aliases, |
| 171 | module_mangle_prefix: None, |
| 172 | source_file: Some(format!("{name}.hll")), |
| 173 | }); |
| 174 | let out = compiler.compile(src).unwrap_or_else(|diags| { |
| 175 | panic!("kernel stdlib `{name}` compile failed: {diags:?}") |
| 176 | }); |
| 177 | let mut rv = CompilerRv64::new(); |
| 178 | let (_, tokens) = rv.compile_with_tokens(&out.ir); |
| 179 | let obj = Assembler::assemble(&tokens) |
| 180 | .unwrap_or_else(|e| panic!("stdlib `{name}` assemble failed: {e}")); |
no test coverage detected