- /*
- * A p_align of 0 means no alignment, i.e. aligned to
- * 1 byte.
- */
- align = phdr->p_align == 0 ? 1 : phdr->p_align;
- /* Align the start of the segment. */
- _memsz += offset_align(_memsz, align);
- _memsz += phdr->p_memsz;
- /*
- * Add padding at the end of the segment, so it ends
- * on a multiple of the align value (which usually
- * means a page boundary). This makes the computation
- * valid even in cases where p_align would change from
- * one segment to the next.
- */
- _memsz += offset_align(_memsz, align);
+ low_addr = min_t(uint64_t, low_addr, phdr->p_vaddr);
+ high_addr = max_t(uint64_t, high_addr,
+ phdr->p_vaddr + phdr->p_memsz);