Skip to content

Commit a1eab1c

Browse files
committed
Modified CompPhdr::operator() so that it provides a strict
weak ordering as required by std::sort.
1 parent 29c085f commit a1eab1c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/patchelf.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ class ElfFile
135135
ElfFile * elfFile;
136136
bool operator ()(const Elf_Phdr & x, const Elf_Phdr & y)
137137
{
138-
if (x.p_type == PT_PHDR) return true;
138+
if (x.p_type == PT_PHDR) {
139+
if (y.p_type == PT_PHDR) return false;
140+
return true;
141+
}
139142
if (y.p_type == PT_PHDR) return false;
140143
return elfFile->rdi(x.p_paddr) < elfFile->rdi(y.p_paddr);
141144
}

0 commit comments

Comments
 (0)