[lld] r250209 - [ELF2] Only call getPPC64SectionRank for EM_PPC64 files

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 12:07:29 PDT 2015


Author: hfinkel
Date: Tue Oct 13 14:07:29 2015
New Revision: 250209

URL: http://llvm.org/viewvc/llvm-project?rev=250209&view=rev
Log:
[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.

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=250209&r1=250208&r2=250209&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Oct 13 14:07:29 2015
@@ -331,7 +331,13 @@ static bool compareOutputSections(Output
       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.




More information about the llvm-commits mailing list