[lld] r302662 - Remove another use of section names. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 07:12:03 PDT 2017


Author: rafael
Date: Wed May 10 09:12:02 2017
New Revision: 302662

URL: http://llvm.org/viewvc/llvm-project?rev=302662&view=rev
Log:
Remove another use of section names. NFC.

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=302662&r1=302661&r2=302662&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed May 10 09:12:02 2017
@@ -1057,10 +1057,10 @@ void LinkerScript::writeDataBytes(Output
       writeInt(Buf + Data->Offset, Data->Expression().getValue(), Data->Size);
 }
 
-bool LinkerScript::hasLMA(StringRef Name) {
+bool LinkerScript::hasLMA(OutputSection *Sec) {
   for (BaseCommand *Base : Opt.Commands)
     if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base))
-      if (Cmd->LMAExpr && Cmd->Name == Name)
+      if (Cmd->LMAExpr && Cmd->Sec == Sec)
         return true;
   return false;
 }

Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=302662&r1=302661&r2=302662&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Wed May 10 09:12:02 2017
@@ -263,7 +263,7 @@ public:
   bool ignoreInterpSection();
 
   llvm::Optional<uint32_t> getFiller(OutputSection *Sec);
-  bool hasLMA(StringRef Name);
+  bool hasLMA(OutputSection *Sec);
   bool shouldKeep(InputSectionBase *S);
   void assignOffsets(OutputSectionCommand *Cmd);
   void placeOrphanSections();

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=302662&r1=302661&r2=302662&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed May 10 09:12:02 2017
@@ -1335,7 +1335,7 @@ template <class ELFT> std::vector<PhdrEn
     // different flags or is loaded at a discontiguous address using AT linker
     // script command.
     uint64_t NewFlags = computeFlags(Sec->getPhdrFlags());
-    if (Script->hasLMA(Sec->Name) || Flags != NewFlags) {
+    if (Script->hasLMA(Sec) || Flags != NewFlags) {
       Load = AddHdr(PT_LOAD, NewFlags);
       Flags = NewFlags;
     }
@@ -1398,7 +1398,7 @@ template <class ELFT> std::vector<PhdrEn
   PhdrEntry *Note = nullptr;
   for (OutputSection *Sec : OutputSections) {
     if (Sec->Type == SHT_NOTE) {
-      if (!Note || Script->hasLMA(Sec->Name))
+      if (!Note || Script->hasLMA(Sec))
         Note = AddHdr(PT_NOTE, PF_R);
       Note->add(Sec);
     } else {




More information about the llvm-commits mailing list