annotate lld/MachO/Dwarf.h @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 //===- DWARF.h -----------------------------------------------*- C++ -*-===//
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 //
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 //===-------------------------------------------------------------------===//
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 #ifndef LLD_MACHO_DWARF_H
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 #define LLD_MACHO_DWARF_H
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 #include "llvm/ADT/StringRef.h"
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 #include "llvm/DebugInfo/DWARF/DWARFObject.h"
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 namespace lld {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 namespace macho {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 class ObjFile;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 // Implements the interface between LLVM's DWARF-parsing utilities and LLD's
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 // InputSection structures.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 class DwarfObject final : public llvm::DWARFObject {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 public:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 bool isLittleEndian() const override { return true; }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 llvm::Optional<llvm::RelocAddrEntry> find(const llvm::DWARFSection &sec,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 uint64_t pos) const override {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 // TODO: implement this
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 return llvm::None;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 void forEachInfoSections(
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 llvm::function_ref<void(const llvm::DWARFSection &)> f) const override {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 f(infoSection);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 llvm::StringRef getAbbrevSection() const override { return abbrevSection; }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 llvm::StringRef getStrSection() const override { return strSection; }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 // Returns an instance of DwarfObject if the given object file has the
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 // relevant DWARF debug sections.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 static std::unique_ptr<DwarfObject> create(ObjFile *);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 private:
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 llvm::DWARFSection infoSection;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 llvm::StringRef abbrevSection;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 llvm::StringRef strSection;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 };
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 } // namespace macho
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 } // namespace lld
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 #endif