MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / section_index_for_addr

Function section_index_for_addr

tests/integration/linker.rs:149–162  ·  view source on GitHub ↗
(sections: &[SectionHeader], addr: u64)

Source from the content-addressed store, hash-verified

147}
148
149fn section_index_for_addr(sections: &[SectionHeader], addr: u64) -> usize {
150 sections
151 .iter()
152 .enumerate()
153 .find(|(_, section)| {
154 if section.sh_size == 0 {
155 section.sh_addr == addr
156 } else {
157 addr >= section.sh_addr && addr < section.sh_addr + section.sh_size
158 }
159 })
160 .map(|(index, _)| index)
161 .unwrap_or_else(|| panic!("no section contains address {addr:#x}"))
162}
163
164fn find_local_label(assembled: &AssembledOutput) -> String {
165 assembled

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected