[ELF] - Linkerscript: remove excessive ScriptConfiguration::Filler field
authorGeorge Rimar <grimar@accesssoftek.com>
Thu, 21 Jul 2016 07:48:54 +0000 (07:48 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Thu, 21 Jul 2016 07:48:54 +0000 (07:48 +0000)
Previously OutputSectionCommand::Filler was introduced, but unused.
Patch fixes that.

Differential revision: https://reviews.llvm.org/D22615

llvm-svn: 276253

lld/ELF/LinkerScript.cpp
lld/ELF/LinkerScript.h

index 85bfae7..7fa953d 100644 (file)
@@ -410,10 +410,11 @@ LinkerScript<ELFT>::createPhdrs(ArrayRef<OutputSectionBase<ELFT> *> Sections) {
 
 template <class ELFT>
 ArrayRef<uint8_t> LinkerScript<ELFT>::getFiller(StringRef Name) {
-  auto I = Opt.Filler.find(Name);
-  if (I == Opt.Filler.end())
-    return {};
-  return I->second;
+  for (const std::unique_ptr<BaseCommand> &Base : Opt.Commands)
+    if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base.get()))
+      if (Cmd->Name == Name)
+        return Cmd->Filler;
+  return {};
 }
 
 // Returns the index of the given section name in linker script
@@ -754,7 +755,7 @@ void ScriptParser::readOutputSectionDescription(StringRef OutSec) {
       return;
     }
     Tok = Tok.substr(3);
-    Opt.Filler[OutSec] = parseHex(Tok);
+    Cmd->Filler = parseHex(Tok);
     next();
   }
 }
index 20ab4be..104cfca 100644 (file)
@@ -86,9 +86,6 @@ struct ScriptConfiguration {
   // SECTIONS commands.
   std::vector<SectionRule> Sections;
 
-  // Section fill attribute for each section.
-  llvm::StringMap<std::vector<uint8_t>> Filler;
-
   // Used to assign addresses to sections.
   std::vector<std::unique_ptr<BaseCommand>> Commands;