[lld] r250109 - [ELF2] Ensure strict weak ordering in section sorting
Hal Finkel via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 12 14:14:03 PDT 2015
Author: hfinkel
Date: Mon Oct 12 16:14:03 2015
New Revision: 250109
URL: http://llvm.org/viewvc/llvm-project?rev=250109&view=rev
Log:
[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.
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=250109&r1=250108&r2=250109&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Oct 12 16:14:03 2015
@@ -319,8 +319,8 @@ static bool compareOutputSections(Output
// 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());
}
More information about the llvm-commits
mailing list