1//===- AArch64ErrataFix.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_AARCH64ERRATAFIX_H
10#define LLD_ELF_AARCH64ERRATAFIX_H
11
12#include "lld/Common/LLVM.h"
13#include "llvm/ADT/DenseMap.h"
14#include "llvm/ADT/SmallVector.h"
15#include <vector>
16
17namespace lld::elf {
18struct Ctx;
19class Defined;
20class InputSection;
21class InputSectionDescription;
22class Patch843419Section;
23
24class AArch64Err843419Patcher {
25public:
26 AArch64Err843419Patcher(Ctx &ctx) : ctx(ctx) {}
27 // return true if Patches have been added to the OutputSections.
28 bool createFixes();
29
30private:
31 std::vector<Patch843419Section *>
32 patchInputSectionDescription(InputSectionDescription &isd);
33
34 void insertPatches(InputSectionDescription &isd,
35 std::vector<Patch843419Section *> &patches);
36
37 void init();
38
39 Ctx &ctx;
40 // A cache mapping InputSections to pairs of section symbols (first) and
41 // the mapping symbols (second) defined by the InputSection sorted in order
42 // of ascending value with redundant symbols removed. These describe the
43 // ranges of code and data in an executable InputSection.
44 llvm::DenseMap<InputSection *,
45 std::pair<Defined *, SmallVector<Defined *, 0>>>
46 sectionMap;
47
48 bool initialized = false;
49};
50
51} // namespace lld::elf
52
53#endif
54