Don't use section names in getFiller. NFC.

This is just faster and avoids using names.

llvm-svn: 302661
This commit is contained in:
Rafael Espindola 2017-05-10 14:01:13 +00:00
parent ff29879f2e
commit c5b612b8b4
4 changed files with 5 additions and 5 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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;