[ELF] - Linkerscript: Fixed SORT_BY_ALIGNMENT sorting order.
According to spec:
"SORT_BY_ALIGNMENT will sort sections into descending order by
alignment before placing them in the output file"
Previously they were sorted into ascending order.
llvm-svn: 277706
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 08d0b95..6117a03 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -136,14 +136,14 @@
bool operator()(InputSectionBase<ELFT> *A, InputSectionBase<ELFT> *B) {
int AlignmentCmp = A->Alignment - B->Alignment;
if (Kind == SortKind::Align || (Kind == SortKind::AlignName && AlignmentCmp != 0))
- return AlignmentCmp < 0;
+ return AlignmentCmp > 0;
int NameCmp = A->getSectionName().compare(B->getSectionName());
if (Kind == SortKind::Name || (Kind == SortKind::NameAlign && NameCmp != 0))
return NameCmp < 0;
if (Kind == SortKind::NameAlign)
- return AlignmentCmp < 0;
+ return AlignmentCmp > 0;
if (Kind == SortKind::AlignName)
return NameCmp < 0;