xref: /freebsd/contrib/llvm-project/lld/ELF/ARMErrataFix.h (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
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 <vector>
1585868e8aSDimitry Andric 
16*bdd1243dSDimitry Andric namespace lld::elf {
1785868e8aSDimitry Andric 
1885868e8aSDimitry Andric class Defined;
1985868e8aSDimitry Andric class InputSection;
20e8d8bef9SDimitry Andric class InputSectionDescription;
2185868e8aSDimitry Andric class Patch657417Section;
2285868e8aSDimitry Andric 
2385868e8aSDimitry Andric class ARMErr657417Patcher {
2485868e8aSDimitry Andric public:
2585868e8aSDimitry Andric   // Return true if Patches have been added to the OutputSections.
2685868e8aSDimitry Andric   bool createFixes();
2785868e8aSDimitry Andric 
2885868e8aSDimitry Andric private:
2985868e8aSDimitry Andric   std::vector<Patch657417Section *>
3085868e8aSDimitry Andric   patchInputSectionDescription(InputSectionDescription &isd);
3185868e8aSDimitry Andric 
3285868e8aSDimitry Andric   void insertPatches(InputSectionDescription &isd,
3385868e8aSDimitry Andric                      std::vector<Patch657417Section *> &patches);
3485868e8aSDimitry Andric 
3585868e8aSDimitry Andric   void init();
3685868e8aSDimitry Andric 
3785868e8aSDimitry Andric   // A cache of the mapping symbols defined by the InputSection sorted in order
3885868e8aSDimitry Andric   // of ascending value with redundant symbols removed. These describe
3985868e8aSDimitry Andric   // the ranges of code and data in an executable InputSection.
4085868e8aSDimitry Andric   llvm::DenseMap<InputSection *, std::vector<const Defined *>> sectionMap;
4185868e8aSDimitry Andric 
4285868e8aSDimitry Andric   bool initialized = false;
4385868e8aSDimitry Andric };
4485868e8aSDimitry Andric 
45*bdd1243dSDimitry Andric } // namespace lld::elf
4685868e8aSDimitry Andric 
4785868e8aSDimitry Andric #endif
48