summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Millar <kmillar@google.com>2017-12-07 12:51:01 -0800
committerKarl Millar <kmillar@google.com>2017-12-07 12:51:01 -0800
commita1eab1c9de4d93ac639c0e2305a1505fc28a3b1c (patch)
tree0aec8010c754767e0bd5e05570e119cc7de1126e
parent29c085fd9d3fc972f75b3961905d6b4ecce7eb2b (diff)
downloadpatchelf-a1eab1c9de4d93ac639c0e2305a1505fc28a3b1c.tar.gz
Modified CompPhdr::operator() so that it provides a strict
weak ordering as required by std::sort.
-rw-r--r--src/patchelf.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc
index 55b38e3..a9696e4 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -135,7 +135,10 @@ private:
ElfFile * elfFile;
bool operator ()(const Elf_Phdr & x, const Elf_Phdr & y)
{
- if (x.p_type == PT_PHDR) return true;
+ 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);
}