[lld] r302661 - Don't use section names in getFiller. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed May 10 07:01:14 PDT 2017
Author: rafael
Date: Wed May 10 09:01:13 2017
New Revision: 302661
URL: http://llvm.org/viewvc/llvm-project?rev=302661&view=rev
Log:
Don't use section names in getFiller. NFC.
This is just faster and avoids using names.
Modified:
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/LinkerScript.h
lld/trunk/ELF/OutputSections.cpp
lld/trunk/ELF/SyntheticSections.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=302661&r1=302660&r2=302661&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed May 10 09:01:13 2017
@@ -1020,10 +1020,10 @@ bool LinkerScript::ignoreInterpSection()
return true;
}
-Optional<uint32_t> LinkerScript::getFiller(StringRef Name) {
+Optional<uint32_t> LinkerScript::getFiller(OutputSection *Sec) {
for (BaseCommand *Base : Opt.Commands)
if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base))
- if (Cmd->Name == Name)
+ if (Cmd->Sec == Sec)
return Cmd->Filler;
return None;
}
Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=302661&r1=302660&r2=302661&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Wed May 10 09:01:13 2017
@@ -262,7 +262,7 @@ public:
std::vector<PhdrEntry> createPhdrs();
bool ignoreInterpSection();
- llvm::Optional<uint32_t> getFiller(StringRef Name);
+ llvm::Optional<uint32_t> getFiller(OutputSection *Sec);
bool hasLMA(StringRef Name);
bool shouldKeep(InputSectionBase *S);
void assignOffsets(OutputSectionCommand *Cmd);
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=302661&r1=302660&r2=302661&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Wed May 10 09:01:13 2017
@@ -273,7 +273,7 @@ uint32_t OutputSection::getFiller() {
// linker script. If nothing is specified and this is an executable section,
// fall back to trap instructions to prevent bad diassembly and detect invalid
// jumps to padding.
- if (Optional<uint32_t> Filler = Script->getFiller(Name))
+ if (Optional<uint32_t> Filler = Script->getFiller(this))
return *Filler;
if (Flags & SHF_EXECINSTR)
return Target->TrapInstr;
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=302661&r1=302660&r2=302661&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Wed May 10 09:01:13 2017
@@ -2187,7 +2187,7 @@ MipsRldMapSection::MipsRldMapSection()
void MipsRldMapSection::writeTo(uint8_t *Buf) {
// Apply filler from linker script.
- Optional<uint32_t> Fill = Script->getFiller(this->Name);
+ Optional<uint32_t> Fill = Script->getFiller(this->OutSec);
if (!Fill || *Fill == 0)
return;
More information about the llvm-commits
mailing list