Pass OutputSectionCommand to forEachExecInputSection's callback.

NFC, just makes the OutputSectionCommand available.

llvm-svn: 308056
This commit is contained in:
Rafael Espindola 2017-07-14 21:33:14 +00:00
parent 6fdfede10d
commit e8b087c7e4
2 changed files with 7 additions and 7 deletions

View File

@ -1066,7 +1066,7 @@ std::pair<Thunk *, bool> ThunkCreator::getThunk(SymbolBody &Body,
// InputSectionDescription::Sections.
void ThunkCreator::forEachExecInputSection(
ArrayRef<OutputSectionCommand *> OutputSections,
std::function<void(OutputSection *, std::vector<InputSection *> *,
std::function<void(OutputSectionCommand *, std::vector<InputSection *> *,
InputSection *)>
Fn) {
for (OutputSectionCommand *Cmd : OutputSections) {
@ -1077,7 +1077,7 @@ void ThunkCreator::forEachExecInputSection(
if (auto *ISD = dyn_cast<InputSectionDescription>(BC)) {
CurTS = nullptr;
for (InputSection *IS : ISD->Sections)
Fn(OS, &ISD->Sections, IS);
Fn(Cmd, &ISD->Sections, IS);
}
}
}
@ -1104,8 +1104,8 @@ bool ThunkCreator::createThunks(
// ThunkSections back into the OutputSection as ThunkSections are not always
// inserted into the same OutputSection as the caller.
forEachExecInputSection(
OutputSections, [&](OutputSection *OS, std::vector<InputSection*> *ISR,
InputSection *IS) {
OutputSections, [&](OutputSectionCommand *Cmd,
std::vector<InputSection *> *ISR, InputSection *IS) {
for (Relocation &Rel : IS->Relocations) {
SymbolBody &Body = *Rel.Sym;
if (Thunks.find(&Body) != Thunks.end() ||
@ -1118,9 +1118,9 @@ bool ThunkCreator::createThunks(
// Find or create a ThunkSection for the new Thunk
ThunkSection *TS;
if (auto *TIS = T->getTargetInputSection())
TS = getISThunkSec(TIS, OS);
TS = getISThunkSec(TIS, Cmd->Sec);
else
TS = getOSThunkSec(OS, ISR);
TS = getOSThunkSec(Cmd->Sec, ISR);
TS->addThunk(T);
Thunks[T->ThunkSym] = T;
}

View File

@ -138,7 +138,7 @@ private:
ThunkSection *getISThunkSec(InputSection *IS, OutputSection *OS);
void forEachExecInputSection(
ArrayRef<OutputSectionCommand *> OutputSections,
std::function<void(OutputSection *, std::vector<InputSection *> *,
std::function<void(OutputSectionCommand *, std::vector<InputSection *> *,
InputSection *)>
Fn);
std::pair<Thunk *, bool> getThunk(SymbolBody &Body, uint32_t Type);