[lld] r315169 - Rename ignoreInterpSection -> needsInterpSection.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 7 20:52:15 PDT 2017


Author: ruiu
Date: Sat Oct  7 20:52:15 2017
New Revision: 315169

URL: http://llvm.org/viewvc/llvm-project?rev=315169&view=rev
Log:
Rename ignoreInterpSection -> needsInterpSection.

This should improve consistency. Also added comment.

Modified:
    lld/trunk/ELF/LinkerScript.cpp
    lld/trunk/ELF/LinkerScript.h
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=315169&r1=315168&r2=315169&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Sat Oct  7 20:52:15 2017
@@ -841,15 +841,18 @@ std::vector<PhdrEntry *> LinkerScript::c
   return Ret;
 }
 
-bool LinkerScript::ignoreInterpSection() {
-  // Ignore .interp section in case we have PHDRS specification
-  // and PT_INTERP isn't listed.
+// Returns true if we should emit an .interp section.
+//
+// We usually do. But if PHDRS commands are given, and
+// no PT_INTERP is there, there's no place to emit an
+// .interp, so we don't do that in that case.
+bool LinkerScript::needsInterpSection() {
   if (Opt.PhdrsCommands.empty())
-    return false;
+    return true;
   for (PhdrsCommand &Cmd : Opt.PhdrsCommands)
     if (Cmd.Type == PT_INTERP)
-      return false;
-  return true;
+      return true;
+  return false;
 }
 
 ExprValue LinkerScript::getSymbolValue(const Twine &Loc, StringRef S) {

Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=315169&r1=315168&r2=315169&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Sat Oct  7 20:52:15 2017
@@ -248,7 +248,7 @@ public:
   void adjustSectionsAfterSorting();
 
   std::vector<PhdrEntry *> createPhdrs();
-  bool ignoreInterpSection();
+  bool needsInterpSection();
 
   bool shouldKeep(InputSectionBase *S);
   void assignOffsets(OutputSection *Sec);

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=315169&r1=315168&r2=315169&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Sat Oct  7 20:52:15 2017
@@ -117,7 +117,7 @@ StringRef elf::getOutputSectionName(Stri
 
 static bool needsInterpSection() {
   return !SharedFiles.empty() && !Config->DynamicLinker.empty() &&
-         !Script->ignoreInterpSection();
+         Script->needsInterpSection();
 }
 
 template <class ELFT> void elf::writeResult() { Writer<ELFT>().run(); }




More information about the llvm-commits mailing list