207
|
1 //===- UnwindInfoSection.h ------------------------------------------------===//
|
|
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_MACHO_UNWIND_INFO_H
|
|
10 #define LLD_MACHO_UNWIND_INFO_H
|
|
11
|
|
12 #include "ConcatOutputSection.h"
|
|
13 #include "SyntheticSections.h"
|
|
14
|
|
15 #include "mach-o/compact_unwind_encoding.h"
|
|
16 #include "llvm/ADT/DenseMap.h"
|
|
17
|
|
18 #include <vector>
|
|
19
|
|
20 namespace lld {
|
|
21 namespace macho {
|
|
22
|
|
23 template <class Ptr> struct CompactUnwindEntry {
|
|
24 Ptr functionAddress;
|
|
25 uint32_t functionLength;
|
|
26 compact_unwind_encoding_t encoding;
|
|
27 Ptr personality;
|
|
28 Ptr lsda;
|
|
29 };
|
|
30
|
|
31 class UnwindInfoSection : public SyntheticSection {
|
|
32 public:
|
|
33 bool isNeeded() const override { return compactUnwindSection != nullptr; }
|
|
34 uint64_t getSize() const override { return unwindInfoSize; }
|
|
35 virtual void prepareRelocations(InputSection *) = 0;
|
|
36
|
|
37 void setCompactUnwindSection(ConcatOutputSection *cuSection) {
|
|
38 compactUnwindSection = cuSection;
|
|
39 }
|
|
40
|
|
41 protected:
|
|
42 UnwindInfoSection()
|
|
43 : SyntheticSection(segment_names::text, section_names::unwindInfo) {
|
|
44 align = 4;
|
|
45 }
|
|
46
|
|
47 ConcatOutputSection *compactUnwindSection = nullptr;
|
|
48 uint64_t unwindInfoSize = 0;
|
|
49 };
|
|
50
|
|
51 UnwindInfoSection *makeUnwindInfoSection();
|
|
52
|
|
53 } // namespace macho
|
|
54 } // namespace lld
|
|
55
|
|
56 #endif
|