forked from OSchip/llvm-project
Move a function out of a class because it doesn't depend on any class member. NFC.
llvm-svn: 345093
This commit is contained in:
parent
e44a63a0a4
commit
b0de6c742a
|
@ -1088,6 +1088,20 @@ static bool mergeCmp(const InputSection *A, const InputSection *B) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Call Fn on every executable InputSection accessed via the linker script
|
||||
// InputSectionDescription::Sections.
|
||||
static void forEachInputSectionDescription(
|
||||
ArrayRef<OutputSection *> OutputSections,
|
||||
llvm::function_ref<void(OutputSection *, InputSectionDescription *)> Fn) {
|
||||
for (OutputSection *OS : OutputSections) {
|
||||
if (!(OS->Flags & SHF_ALLOC) || !(OS->Flags & SHF_EXECINSTR))
|
||||
continue;
|
||||
for (BaseCommand *BC : OS->SectionCommands)
|
||||
if (auto *ISD = dyn_cast<InputSectionDescription>(BC))
|
||||
Fn(OS, ISD);
|
||||
}
|
||||
}
|
||||
|
||||
// Thunk Implementation
|
||||
//
|
||||
// Thunks (sometimes called stubs, veneers or branch islands) are small pieces
|
||||
|
@ -1355,20 +1369,6 @@ std::pair<Thunk *, bool> ThunkCreator::getThunk(Symbol &Sym, RelType Type,
|
|||
return std::make_pair(T, true);
|
||||
}
|
||||
|
||||
// Call Fn on every executable InputSection accessed via the linker script
|
||||
// InputSectionDescription::Sections.
|
||||
void ThunkCreator::forEachInputSectionDescription(
|
||||
ArrayRef<OutputSection *> OutputSections,
|
||||
llvm::function_ref<void(OutputSection *, InputSectionDescription *)> Fn) {
|
||||
for (OutputSection *OS : OutputSections) {
|
||||
if (!(OS->Flags & SHF_ALLOC) || !(OS->Flags & SHF_EXECINSTR))
|
||||
continue;
|
||||
for (BaseCommand *BC : OS->SectionCommands)
|
||||
if (auto *ISD = dyn_cast<InputSectionDescription>(BC))
|
||||
Fn(OS, ISD);
|
||||
}
|
||||
}
|
||||
|
||||
// Return true if the relocation target is an in range Thunk.
|
||||
// Return false if the relocation is not to a Thunk. If the relocation target
|
||||
// was originally to a Thunk, but is no longer in range we revert the
|
||||
|
|
|
@ -173,10 +173,6 @@ private:
|
|||
|
||||
void createInitialThunkSections(ArrayRef<OutputSection *> OutputSections);
|
||||
|
||||
void forEachInputSectionDescription(
|
||||
ArrayRef<OutputSection *> OutputSections,
|
||||
llvm::function_ref<void(OutputSection *, InputSectionDescription *)> Fn);
|
||||
|
||||
std::pair<Thunk *, bool> getThunk(Symbol &Sym, RelType Type, uint64_t Src);
|
||||
|
||||
ThunkSection *addThunkSection(OutputSection *OS, InputSectionDescription *,
|
||||
|
|
Loading…
Reference in New Issue