xref: /freebsd/contrib/llvm-project/lld/ELF/ARMErrataFix.h (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
185868e8aSDimitry Andric //===- ARMErrataFix.h -------------------------------------------*- C++ -*-===//
285868e8aSDimitry Andric //
385868e8aSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
485868e8aSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
585868e8aSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
685868e8aSDimitry Andric //
785868e8aSDimitry Andric //===----------------------------------------------------------------------===//
885868e8aSDimitry Andric 
985868e8aSDimitry Andric #ifndef LLD_ELF_ARMA8ERRATAFIX_H
1085868e8aSDimitry Andric #define LLD_ELF_ARMA8ERRATAFIX_H
1185868e8aSDimitry Andric 
1285868e8aSDimitry Andric #include "lld/Common/LLVM.h"
1385868e8aSDimitry Andric #include "llvm/ADT/DenseMap.h"
1485868e8aSDimitry Andric #include <map>
1585868e8aSDimitry Andric #include <vector>
1685868e8aSDimitry Andric 
1785868e8aSDimitry Andric namespace lld {
1885868e8aSDimitry Andric namespace elf {
1985868e8aSDimitry Andric 
2085868e8aSDimitry Andric class Defined;
2185868e8aSDimitry Andric class InputSection;
22*e8d8bef9SDimitry Andric class InputSectionDescription;
2385868e8aSDimitry Andric class OutputSection;
2485868e8aSDimitry Andric class Patch657417Section;
2585868e8aSDimitry Andric 
2685868e8aSDimitry Andric class ARMErr657417Patcher {
2785868e8aSDimitry Andric public:
2885868e8aSDimitry Andric   // Return true if Patches have been added to the OutputSections.
2985868e8aSDimitry Andric   bool createFixes();
3085868e8aSDimitry Andric 
3185868e8aSDimitry Andric private:
3285868e8aSDimitry Andric   std::vector<Patch657417Section *>
3385868e8aSDimitry Andric   patchInputSectionDescription(InputSectionDescription &isd);
3485868e8aSDimitry Andric 
3585868e8aSDimitry Andric   void insertPatches(InputSectionDescription &isd,
3685868e8aSDimitry Andric                      std::vector<Patch657417Section *> &patches);
3785868e8aSDimitry Andric 
3885868e8aSDimitry Andric   void init();
3985868e8aSDimitry Andric 
4085868e8aSDimitry Andric   // A cache of the mapping symbols defined by the InputSection sorted in order
4185868e8aSDimitry Andric   // of ascending value with redundant symbols removed. These describe
4285868e8aSDimitry Andric   // the ranges of code and data in an executable InputSection.
4385868e8aSDimitry Andric   llvm::DenseMap<InputSection *, std::vector<const Defined *>> sectionMap;
4485868e8aSDimitry Andric 
4585868e8aSDimitry Andric   bool initialized = false;
4685868e8aSDimitry Andric };
4785868e8aSDimitry Andric 
4885868e8aSDimitry Andric } // namespace elf
4985868e8aSDimitry Andric } // namespace lld
5085868e8aSDimitry Andric 
5185868e8aSDimitry Andric #endif
52