[ELF2] Only call getPPC64SectionRank for EM_PPC64 files
Suggested by Rafael in his review of r250100. As Rafael points out, this may
grow into a switch in the future, but regardless, calling this on files for
other architectures is unnecessary.
llvm-svn: 250209
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 484989b..52d46b5 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -331,7 +331,13 @@
A->getType() != B->getType())
return A->getType() != SHT_NOBITS && B->getType() == SHT_NOBITS;
- return getPPC64SectionRank(A->getName()) < getPPC64SectionRank(B->getName());
+ // Some architectures have additional ordering restrictions for sections
+ // within the same PT_LOAD.
+ if (Config->EMachine == EM_PPC64)
+ return getPPC64SectionRank(A->getName()) <
+ getPPC64SectionRank(B->getName());
+
+ return false;
}
// Until this function is called, common symbols do not belong to any section.