Function
encode_jal
(
rd: u8,
target: &str,
current_addr: u64,
symbols: &super::symbol_table::SymbolTable,
)
Source from the content-addressed store, hash-verified
| 279 | if !out.global_symbols.contains(g) { |
| 280 | out.global_symbols.push(g.clone()); |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | Ok(out) |
| 285 | } |
| 286 | |
| 287 | // --- Branch and jump encoding helpers --- |
| 288 | |
| 289 | // Layout symbols are section-relative; prefer the section-qualified entry so |
| 290 | // same-named labels in other sections can't shadow the local one. |
| 291 | fn resolve_section_local( |
| 292 | target: &str, |
| 293 | section_name: &str, |
| 294 | symbols: &super::symbol_table::SymbolTable, |
| 295 | ) -> Option<u64> { |
| 296 | symbols |
| 297 | .resolve(&format!("{target}@{section_name}")) |
| 298 | .or_else(|| symbols.resolve(target)) |
| 299 | } |
| 300 | |
| 301 | fn encode_branch( |
| 302 | kind: &BranchKind, |
| 303 | rs1: u8, |
| 304 | rs2: u8, |
| 305 | target: &str, |
| 306 | site_local: u64, |
| 307 | section_name: &str, |
Tested by
no test coverage detected