summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/patchelf.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc
index 31da196..26d5805 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -384,7 +384,8 @@ void ElfFile<ElfFileParamNames>::shiftFile(unsigned int extraPages, Elf_Addr sta
/* Update the offsets in the program headers. */
for (int i = 0; i < rdi(hdr->e_phnum); ++i) {
wri(phdrs[i].p_offset, rdi(phdrs[i].p_offset) + shift);
- if ((phdrs[i].p_vaddr - phdrs[i].p_offset) % phdrs[i].p_align != 0) {
+ if (phdrs[i].p_align != 0 &&
+ (phdrs[i].p_vaddr - phdrs[i].p_offset) % phdrs[i].p_align != 0) {
debug("changing alignment of program header %d from %d to %d\n", i,
phdrs[i].p_align, pageSize);
phdrs[i].p_align = pageSize;