We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents aceb96e + 71e99c5 commit b6d0317Copy full SHA for b6d0317
src/patchelf.cc
@@ -135,9 +135,12 @@ class ElfFile
135
ElfFile * elfFile;
136
bool operator ()(const Elf_Phdr & x, const Elf_Phdr & y)
137
{
138
- if (x.p_type == PT_PHDR) return true;
139
- if (y.p_type == PT_PHDR) return false;
140
- 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;
141
+
142
+ // Sort non-PHDRs by address.
143
+ return elfFile->rdi(x.p_paddr) < elfFile->rdi(y.p_paddr);
144
}
145
};
146
0 commit comments