diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2018-01-08 18:06:46 (GMT) |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2018-01-08 18:06:46 (GMT) |
commit | b6d0317803fe3f2737d705567b0cc16086cc749b (patch) | |
tree | fc043d6cbef6682a86fdfe135c56be85cfd9d616 /src | |
parent | aceb96e9a8698e8bd0c6295939d217489bd26ef9 (diff) | |
parent | 71e99c549cb3acd03574c9c0b66c561ad35e71f7 (diff) | |
download | patchelf-b6d0317803fe3f2737d705567b0cc16086cc749b.zip patchelf-b6d0317803fe3f2737d705567b0cc16086cc749b.tar.gz patchelf-b6d0317803fe3f2737d705567b0cc16086cc749b.tar.bz2 |
Merge branch 'strict_ordering' of https://github.com/kmillar/patchelf
Diffstat (limited to 'src')
-rw-r--r-- | src/patchelf.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index 0e9aeb7..cd46f7e 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -135,9 +135,12 @@ private: ElfFile * elfFile; bool operator ()(const Elf_Phdr & x, const Elf_Phdr & y) { - if (x.p_type == PT_PHDR) 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); } }; |