diff options
author | Hal Finkel <hfinkel@anl.gov> | 2015-10-13 19:27:12 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2015-10-13 19:27:12 +0000 |
commit | 600ff141ecf9b37b870b99cceedc8d24c7f9eb31 (patch) | |
tree | 3ab438fdb73f8f922bff40625a5b1c3750e750e3 | |
parent | be4d8cba1ccf6f0611db50e8c7ba366ce3a3137d (diff) | |
download | bcm5719-llvm-600ff141ecf9b37b870b99cceedc8d24c7f9eb31.tar.gz bcm5719-llvm-600ff141ecf9b37b870b99cceedc8d24c7f9eb31.zip |
[ELF2] Simplify the NOBITS sorting logic
As Rafael suggested in his review of r250190, we can simplify this by writing
it like the earlier checks.
llvm-svn: 250212
-rw-r--r-- | lld/ELF/Writer.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 52d46b56ce1..179e2f0a26a 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -327,9 +327,10 @@ 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) && - A->getType() != B->getType()) - return A->getType() != SHT_NOBITS && B->getType() == SHT_NOBITS; + bool AIsNoBits = A->getType() == SHT_NOBITS; + bool BIsNoBits = B->getType() == SHT_NOBITS; + if (AIsNoBits != BIsNoBits) + return BIsNoBits; // Some architectures have additional ordering restrictions for sections // within the same PT_LOAD. |