In some cases, we need to make room for new program headers, which means moving some sections towards the end of the file. However, if one of those sections is one we are adding in the same call, we need special handling.
VZTI2E23QPSI2BQJVYHRYZ7SYNGMVCD345JJXUBPSVBHWQA3IQNAC
// Update the corresponding segment, which may have been
// moved just above (hence the resetting of programs[..]
// above).
for (o, _, ty, _, p) in &programs {
if *o == old_offset && *ty != Pht::LOAD {
let mut p = self.program_mut(*p as usize);
p.set_offset(id, new_offset);
p.set_filesz(id, new.len());
p.set_memsz(id, new.len());
p.set_vaddr(id, last_vaddr as usize);
}
}