diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/patchelf.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index a9696e4..855243a 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -135,12 +135,12 @@ private: ElfFile * elfFile; bool operator ()(const Elf_Phdr & x, const Elf_Phdr & y) { - if (x.p_type == PT_PHDR) { - if (y.p_type == PT_PHDR) return false; - return true; - } - if (y.p_type == PT_PHDR) return false; - return elfFile->rdi(x.p_paddr) < elfFile->rdi(y.p_paddr); + // A PHDR comes before everything else. + if (y.p_type == PT_PHDR) return false; + if (x.p_type == PT_PHDR) return true; + + // Sort non-PHDRs by address. + return elfFile->rdi(x.p_paddr) < elfFile->rdi(y.p_paddr); } }; |