mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-16 20:41:44 +00:00
[ELF] Use stable_sort for compareByFilePosition
The comment at the top of compareByFilePosition indicates that it relies on stable_sort to preserve the order of synthetic sections. We were using sort instead of stable_sort, however, leading to incorrect synthetic section ordering. Differential Revision: https://reviews.llvm.org/D35473 llvm-svn: 308207
This commit is contained in:
parent
f9dc3deaa6
commit
e1d7776c53
@ -1084,7 +1084,7 @@ template <class ELFT> void OutputSectionCommand::finalize() {
|
||||
}
|
||||
|
||||
if ((Sec->Flags & SHF_LINK_ORDER)) {
|
||||
std::sort(Sections.begin(), Sections.end(), compareByFilePosition);
|
||||
std::stable_sort(Sections.begin(), Sections.end(), compareByFilePosition);
|
||||
for (int I = 0, N = Sections.size(); I < N; ++I)
|
||||
*ScriptSections[I] = Sections[I];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user