]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lld/ELF/GdbIndex.h
MFC r345703:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lld / ELF / GdbIndex.h
1 //===- GdbIndex.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_GDB_INDEX_H
11 #define LLD_ELF_GDB_INDEX_H
12
13 #include "InputFiles.h"
14 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
15 #include "llvm/Object/ELF.h"
16
17 namespace lld {
18 namespace elf {
19
20 class InputSection;
21
22 struct LLDDWARFSection final : public llvm::DWARFSection {
23   InputSectionBase *Sec = nullptr;
24 };
25
26 template <class ELFT> class LLDDwarfObj final : public llvm::DWARFObject {
27   LLDDWARFSection InfoSection;
28   LLDDWARFSection RangeSection;
29   LLDDWARFSection LineSection;
30   StringRef AbbrevSection;
31   StringRef GnuPubNamesSection;
32   StringRef GnuPubTypesSection;
33   StringRef StrSection;
34
35   template <class RelTy>
36   llvm::Optional<llvm::RelocAddrEntry> findAux(const InputSectionBase &Sec,
37                                                uint64_t Pos,
38                                                ArrayRef<RelTy> Rels) const;
39
40 public:
41   explicit LLDDwarfObj(ObjFile<ELFT> *Obj);
42   const llvm::DWARFSection &getInfoSection() const override {
43     return InfoSection;
44   }
45   const llvm::DWARFSection &getRangeSection() const override {
46     return RangeSection;
47   }
48   const llvm::DWARFSection &getLineSection() const override {
49     return LineSection;
50   }
51   StringRef getFileName() const override { return ""; }
52   StringRef getAbbrevSection() const override { return AbbrevSection; }
53   StringRef getStringSection() const override { return StrSection; }
54   StringRef getGnuPubNamesSection() const override {
55     return GnuPubNamesSection;
56   }
57   StringRef getGnuPubTypesSection() const override {
58     return GnuPubTypesSection;
59   }
60   bool isLittleEndian() const override {
61     return ELFT::TargetEndianness == llvm::support::little;
62   }
63   llvm::Optional<llvm::RelocAddrEntry> find(const llvm::DWARFSection &Sec,
64                                             uint64_t Pos) const override;
65 };
66
67 } // namespace elf
68 } // namespace lld
69
70 #endif