diff options
-rw-r--r-- | lld/ELF/Relocations.cpp | 28 | ||||
-rw-r--r-- | lld/ELF/Relocations.h | 4 |
2 files changed, 14 insertions, 18 deletions
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index d7f79c1c92e..fb31cd63feb 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -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 diff --git a/lld/ELF/Relocations.h b/lld/ELF/Relocations.h index d482b4e5c0e..bbb8d93bcab 100644 --- a/lld/ELF/Relocations.h +++ b/lld/ELF/Relocations.h @@ -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 *, |