xref: /freebsd/contrib/llvm-project/lld/ELF/ARMErrataFix.h (revision 85868e8a1daeaae7a0e48effb2ea2310ae3b02c6)
1*85868e8aSDimitry Andric //===- ARMErrataFix.h -------------------------------------------*- C++ -*-===//
2*85868e8aSDimitry Andric //
3*85868e8aSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*85868e8aSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*85868e8aSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*85868e8aSDimitry Andric //
7*85868e8aSDimitry Andric //===----------------------------------------------------------------------===//
8*85868e8aSDimitry Andric 
9*85868e8aSDimitry Andric #ifndef LLD_ELF_ARMA8ERRATAFIX_H
10*85868e8aSDimitry Andric #define LLD_ELF_ARMA8ERRATAFIX_H
11*85868e8aSDimitry Andric 
12*85868e8aSDimitry Andric #include "lld/Common/LLVM.h"
13*85868e8aSDimitry Andric #include "llvm/ADT/DenseMap.h"
14*85868e8aSDimitry Andric #include <map>
15*85868e8aSDimitry Andric #include <vector>
16*85868e8aSDimitry Andric 
17*85868e8aSDimitry Andric namespace lld {
18*85868e8aSDimitry Andric namespace elf {
19*85868e8aSDimitry Andric 
20*85868e8aSDimitry Andric class Defined;
21*85868e8aSDimitry Andric class InputSection;
22*85868e8aSDimitry Andric struct InputSectionDescription;
23*85868e8aSDimitry Andric class OutputSection;
24*85868e8aSDimitry Andric class Patch657417Section;
25*85868e8aSDimitry Andric 
26*85868e8aSDimitry Andric class ARMErr657417Patcher {
27*85868e8aSDimitry Andric public:
28*85868e8aSDimitry Andric   // Return true if Patches have been added to the OutputSections.
29*85868e8aSDimitry Andric   bool createFixes();
30*85868e8aSDimitry Andric 
31*85868e8aSDimitry Andric private:
32*85868e8aSDimitry Andric   std::vector<Patch657417Section *>
33*85868e8aSDimitry Andric   patchInputSectionDescription(InputSectionDescription &isd);
34*85868e8aSDimitry Andric 
35*85868e8aSDimitry Andric   void insertPatches(InputSectionDescription &isd,
36*85868e8aSDimitry Andric                      std::vector<Patch657417Section *> &patches);
37*85868e8aSDimitry Andric 
38*85868e8aSDimitry Andric   void init();
39*85868e8aSDimitry Andric 
40*85868e8aSDimitry Andric   // A cache of the mapping symbols defined by the InputSection sorted in order
41*85868e8aSDimitry Andric   // of ascending value with redundant symbols removed. These describe
42*85868e8aSDimitry Andric   // the ranges of code and data in an executable InputSection.
43*85868e8aSDimitry Andric   llvm::DenseMap<InputSection *, std::vector<const Defined *>> sectionMap;
44*85868e8aSDimitry Andric 
45*85868e8aSDimitry Andric   bool initialized = false;
46*85868e8aSDimitry Andric };
47*85868e8aSDimitry Andric 
48*85868e8aSDimitry Andric } // namespace elf
49*85868e8aSDimitry Andric } // namespace lld
50*85868e8aSDimitry Andric 
51*85868e8aSDimitry Andric #endif
52