]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lld/ELF/DWARF.h
MFC r345805: Unify SCSI_STATUS_BUSY retry handling with other cases.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lld / ELF / DWARF.h
1 //===- DWARF.h -----------------------------------------------*- C++ -*-===//
2 //
3 //                             The LLVM Linker
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===-------------------------------------------------------------------===//
9
10 #ifndef LLD_ELF_DWARF_H
11 #define LLD_ELF_DWARF_H
12
13 #include "InputFiles.h"
14 #include "llvm/ADT/STLExtras.h"
15 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
16 #include "llvm/Object/ELF.h"
17
18 namespace lld {
19 namespace elf {
20
21 class InputSection;
22
23 struct LLDDWARFSection final : public llvm::DWARFSection {
24   InputSectionBase *Sec = nullptr;
25 };
26
27 template <class ELFT> class LLDDwarfObj final : public llvm::DWARFObject {
28 public:
29   explicit LLDDwarfObj(ObjFile<ELFT> *Obj);
30
31   void forEachInfoSections(
32       llvm::function_ref<void(const llvm::DWARFSection &)> F) const override {
33     F(InfoSection);
34   }
35
36   const llvm::DWARFSection &getRangeSection() const override {
37     return RangeSection;
38   }
39
40   const llvm::DWARFSection &getRnglistsSection() const override {
41     return RngListsSection;
42   }
43
44   const llvm::DWARFSection &getLineSection() const override {
45     return LineSection;
46   }
47
48   const llvm::DWARFSection &getAddrSection() const override {
49     return AddrSection;
50   }
51
52   const llvm::DWARFSection &getGnuPubNamesSection() const override {
53     return GnuPubNamesSection;
54   }
55
56   const llvm::DWARFSection &getGnuPubTypesSection() const override {
57     return GnuPubTypesSection;
58   }
59
60   StringRef getFileName() const override { return ""; }
61   StringRef getAbbrevSection() const override { return AbbrevSection; }
62   StringRef getStringSection() const override { return StrSection; }
63   StringRef getLineStringSection() const override { return LineStringSection; }
64
65   bool isLittleEndian() const override {
66     return ELFT::TargetEndianness == llvm::support::little;
67   }
68
69   llvm::Optional<llvm::RelocAddrEntry> find(const llvm::DWARFSection &Sec,
70                                             uint64_t Pos) const override;
71
72 private:
73   template <class RelTy>
74   llvm::Optional<llvm::RelocAddrEntry> findAux(const InputSectionBase &Sec,
75                                                uint64_t Pos,
76                                                ArrayRef<RelTy> Rels) const;
77
78   LLDDWARFSection GnuPubNamesSection;
79   LLDDWARFSection GnuPubTypesSection;
80   LLDDWARFSection InfoSection;
81   LLDDWARFSection RangeSection;
82   LLDDWARFSection RngListsSection;
83   LLDDWARFSection LineSection;
84   LLDDWARFSection AddrSection;
85   StringRef AbbrevSection;
86   StringRef StrSection;
87   StringRef LineStringSection;
88 };
89
90 } // namespace elf
91 } // namespace lld
92
93 #endif