[ELF2] Ensure strict weak ordering in section sorting

As pointed out by Rui (post-commit review), we need to always return based on
the section type when the types differ to ensure a strict weak ordering.

llvm-svn: 250109
This commit is contained in:
Hal Finkel 2015-10-12 21:14:03 +00:00
parent 9ad0380b85
commit cf58b6a48c
1 changed files with 2 additions and 2 deletions

View File

@ -319,8 +319,8 @@ static bool compareOutputSections(OutputSectionBase<ELFT::Is64Bits> *A,
// them is a p_memsz that is larger than p_filesz. Seeing that it
// zeros the end of the PT_LOAD, so that has to correspond to the
// nobits sections.
if (A->getType() != SHT_NOBITS && B->getType() == SHT_NOBITS)
return true;
if (A->getType() != B->getType())
return A->getType() != SHT_NOBITS && B->getType() == SHT_NOBITS;
return getPPC64SectionRank(A->getName()) < getPPC64SectionRank(B->getName());
}