Compile each stdlib module independently and return (name, object) pairs. No source concatenation: each HLL file becomes its own object.
(mode: TargetMode)
| 436 | match live.state { |
| 437 | MachineState::Exited(code) => { |
| 438 | eprintln!("fsc: kernel exited with code {code}"); |
| 439 | Ok(ExitCode::from((code & 0xFF) as u8)) |
| 440 | } |
| 441 | MachineState::Faulted(msg) => Err(CliError::Assemble(format!("kernel faulted: {msg}"))), |
| 442 | MachineState::Stopped | MachineState::Paused => Ok(ExitCode::SUCCESS), |
| 443 | MachineState::Running => Err(CliError::Timeout(max_steps)), |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | fn config_for_cli_input(input: &str, mode: TargetMode) -> Result<(NativeFs, RunConfig), CliError> { |
| 448 | let (fs, path) = cli_workspace_for_input(input)?; |
| 449 | let config = if has_extension(input, "build") { |
| 450 | run_config_from_manifest(&fs, path).map_err(CliError::Io)? |
| 451 | } else { |
| 452 | let kind = match mode { |
| 453 | TargetMode::Hosted => RunKind::Hosted, |
| 454 | TargetMode::Freestanding => RunKind::Freestanding, |
| 455 | TargetMode::Kernel => RunKind::KernelBoot, |
| 456 | }; |
| 457 | let mut config = RunConfig::hosted(source_stem(input, "program"), VPath::root()); |
| 458 | config.kind = kind; |
| 459 | config.build = BuildRef::SourceWithDefaults { |
| 460 | root: path, |
| 461 | target: mode, |