1 //===- DWARF.h -----------------------------------------------*- C++ -*-===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===-------------------------------------------------------------------===//
10 #ifndef LLD_ELF_DWARF_H
11 #define LLD_ELF_DWARF_H
13 #include "InputFiles.h"
14 #include "llvm/ADT/STLExtras.h"
15 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
16 #include "llvm/Object/ELF.h"
23 struct LLDDWARFSection final : public llvm::DWARFSection {
24 InputSectionBase *Sec = nullptr;
27 template <class ELFT> class LLDDwarfObj final : public llvm::DWARFObject {
29 explicit LLDDwarfObj(ObjFile<ELFT> *Obj);
31 void forEachInfoSections(
32 llvm::function_ref<void(const llvm::DWARFSection &)> F) const override {
36 const llvm::DWARFSection &getRangeSection() const override {
40 const llvm::DWARFSection &getRnglistsSection() const override {
41 return RngListsSection;
44 const llvm::DWARFSection &getLineSection() const override {
48 const llvm::DWARFSection &getAddrSection() const override {
52 const llvm::DWARFSection &getGnuPubNamesSection() const override {
53 return GnuPubNamesSection;
56 const llvm::DWARFSection &getGnuPubTypesSection() const override {
57 return GnuPubTypesSection;
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; }
65 bool isLittleEndian() const override {
66 return ELFT::TargetEndianness == llvm::support::little;
69 llvm::Optional<llvm::RelocAddrEntry> find(const llvm::DWARFSection &Sec,
70 uint64_t Pos) const override;
73 template <class RelTy>
74 llvm::Optional<llvm::RelocAddrEntry> findAux(const InputSectionBase &Sec,
76 ArrayRef<RelTy> Rels) const;
78 LLDDWARFSection GnuPubNamesSection;
79 LLDDWARFSection GnuPubTypesSection;
80 LLDDWARFSection InfoSection;
81 LLDDWARFSection RangeSection;
82 LLDDWARFSection RngListsSection;
83 LLDDWARFSection LineSection;
84 LLDDWARFSection AddrSection;
85 StringRef AbbrevSection;
87 StringRef LineStringSection;