Peter Smith | ea99ce5 | 2019-09-16 09:38:38 | [diff] [blame] | 1 | //===- ARMErrataFix.h -------------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLD_ELF_ARMA8ERRATAFIX_H |
| 10 | #define LLD_ELF_ARMA8ERRATAFIX_H |
| 11 | |
| 12 | #include "lld/Common/LLVM.h" |
| 13 | #include "llvm/ADT/DenseMap.h" |
Peter Smith | ea99ce5 | 2019-09-16 09:38:38 | [diff] [blame] | 14 | #include <vector> |
| 15 | |
Nico Weber | 87248ba | 2022-08-10 19:31:58 | [diff] [blame] | 16 | namespace lld::elf { |
Fangrui Song | b3e0bd3 | 2024-10-06 07:31:51 | [diff] [blame] | 17 | struct Ctx; |
Peter Smith | ea99ce5 | 2019-09-16 09:38:38 | [diff] [blame] | 18 | class Defined; |
| 19 | class InputSection; |
Andrew Ng | 77152a6 | 2020-09-09 09:48:21 | [diff] [blame] | 20 | class InputSectionDescription; |
Peter Smith | ea99ce5 | 2019-09-16 09:38:38 | [diff] [blame] | 21 | class Patch657417Section; |
| 22 | |
| 23 | class ARMErr657417Patcher { |
| 24 | public: |
Fangrui Song | b3e0bd3 | 2024-10-06 07:31:51 | [diff] [blame] | 25 | ARMErr657417Patcher(Ctx &ctx) : ctx(ctx) {} |
Peter Smith | ea99ce5 | 2019-09-16 09:38:38 | [diff] [blame] | 26 | // Return true if Patches have been added to the OutputSections. |
| 27 | bool createFixes(); |
| 28 | |
| 29 | private: |
| 30 | std::vector<Patch657417Section *> |
| 31 | patchInputSectionDescription(InputSectionDescription &isd); |
| 32 | |
| 33 | void insertPatches(InputSectionDescription &isd, |
| 34 | std::vector<Patch657417Section *> &patches); |
| 35 | |
| 36 | void init(); |
| 37 | |
Fangrui Song | b3e0bd3 | 2024-10-06 07:31:51 | [diff] [blame] | 38 | Ctx &ctx; |
Peter Smith | ea99ce5 | 2019-09-16 09:38:38 | [diff] [blame] | 39 | // A cache of the mapping symbols defined by the InputSection sorted in order |
| 40 | // of ascending value with redundant symbols removed. These describe |
| 41 | // the ranges of code and data in an executable InputSection. |
| 42 | llvm::DenseMap<InputSection *, std::vector<const Defined *>> sectionMap; |
| 43 | |
| 44 | bool initialized = false; |
| 45 | }; |
| 46 | |
Nico Weber | 87248ba | 2022-08-10 19:31:58 | [diff] [blame] | 47 | } // namespace lld::elf |
Peter Smith | ea99ce5 | 2019-09-16 09:38:38 | [diff] [blame] | 48 | |
| 49 | #endif |