diff options
| author | Shoaib Meenai <smeenai@fb.com> | 2017-07-17 19:42:19 +0000 |
|---|---|---|
| committer | Shoaib Meenai <smeenai@fb.com> | 2017-07-17 19:42:19 +0000 |
| commit | e1d7776c53bf71a20c613fd8e6087be436f7904f (patch) | |
| tree | 338304991566ce778e1382d945dc18b8200940e5 | |
| parent | f9dc3deaa6ff46aee8adf5f7f38a94daf904c21d (diff) | |
| download | bcm5719-llvm-e1d7776c53bf71a20c613fd8e6087be436f7904f.tar.gz bcm5719-llvm-e1d7776c53bf71a20c613fd8e6087be436f7904f.zip | |
[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
| -rw-r--r-- | lld/ELF/LinkerScript.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 84c9074ccdd..8bab0f9ebf8 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -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]; |

