| 1034 | let mut out = ObjectLinker::link(modules)?; |
| 1035 | let layout = self.effective_link_layout(); |
| 1036 | if layout.emit_layout_symbols { |
| 1037 | out.inject_layout_symbols(&layout); |
| 1038 | } |
| 1039 | out.mark_entry_global(self.effective_entry_point()); |
| 1040 | let stem = sanitize_artifact_component(stem); |
| 1041 | *self.last_artifact_stem.borrow_mut() = Some(stem.clone()); |
| 1042 | self.write_bytes_artifact( |
| 1043 | "elf", |
| 1044 | &format!("total_{stem}"), |
| 1045 | ".elf", |
| 1046 | &out.to_elf_with_entry(self.effective_load_base(), self.effective_entry_point()), |
| 1047 | ); |
| 1048 | Ok(out) |
| 1049 | } |
| 1050 | |
| 1051 | /// Compile named modules independently, one `.o` each, returned in input order. |
| 1052 | /// Fails with the diagnostics of the first module that does not compile. |
| 1053 | #[track_caller] |
| 1054 | pub fn compile_modules( |
| 1055 | &mut self, |
| 1056 | modules: &[(&str, &str)], |
| 1057 | ) -> Result<Vec<AssembledOutput>, CompilationError> { |
| 1058 | let mut result = Vec::with_capacity(modules.len()); |
| 1059 | |
| 1060 | for (module_name, source) in modules { |