Coverage Report

Created: 2018-08-19 21:11

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/ELF/GdbIndex.cpp
Line
Count
Source
1
//===- GdbIndex.cpp -------------------------------------------------------===//
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
// The -gdb-index option instructs the linker to emit a .gdb_index section.
11
// The section contains information to make gdb startup faster.
12
// The format of the section is described at
13
// https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html.
14
//
15
//===----------------------------------------------------------------------===//
16
17
#include "GdbIndex.h"
18
#include "Symbols.h"
19
#include "lld/Common/Memory.h"
20
#include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h"
21
#include "llvm/Object/ELFObjectFile.h"
22
23
using namespace llvm;
24
using namespace llvm::object;
25
using namespace lld;
26
using namespace lld::elf;
27
28
177
template <class ELFT> LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *Obj) {
29
1.12k
  for (InputSectionBase *Sec : Obj->getSections()) {
30
1.12k
    if (!Sec)
31
726
      continue;
32
401
    if (LLDDWARFSection *M = StringSwitch<LLDDWARFSection *>(Sec->Name)
33
61
                                 .Case(".debug_info", &InfoSection)
34
61
                                 .Case(".debug_ranges", &RangeSection)
35
61
                                 .Case(".debug_line", &LineSection)
36
61
                                 .Default(nullptr)) {
37
61
      Sec->maybeDecompress();
38
61
      M->Data = toStringRef(Sec->Data);
39
61
      M->Sec = Sec;
40
61
      continue;
41
61
    }
42
340
    if (Sec->Name == ".debug_abbrev")
43
31
      AbbrevSection = toStringRef(Sec->Data);
44
309
    else if (Sec->Name == ".debug_gnu_pubnames")
45
4
      GnuPubNamesSection = toStringRef(Sec->Data);
46
305
    else if (Sec->Name == ".debug_gnu_pubtypes")
47
4
      GnuPubTypesSection = toStringRef(Sec->Data);
48
301
    else if (Sec->Name == ".debug_str")
49
9
      StrSection = toStringRef(Sec->Data);
50
340
  }
51
177
}
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::LLDDwarfObj(lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)1, false> >*)
Line
Count
Source
28
13
template <class ELFT> LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *Obj) {
29
81
  for (InputSectionBase *Sec : Obj->getSections()) {
30
81
    if (!Sec)
31
57
      continue;
32
24
    if (LLDDWARFSection *M = StringSwitch<LLDDWARFSection *>(Sec->Name)
33
6
                                 .Case(".debug_info", &InfoSection)
34
6
                                 .Case(".debug_ranges", &RangeSection)
35
6
                                 .Case(".debug_line", &LineSection)
36
6
                                 .Default(nullptr)) {
37
6
      Sec->maybeDecompress();
38
6
      M->Data = toStringRef(Sec->Data);
39
6
      M->Sec = Sec;
40
6
      continue;
41
6
    }
42
18
    if (Sec->Name == ".debug_abbrev")
43
2
      AbbrevSection = toStringRef(Sec->Data);
44
16
    else if (Sec->Name == ".debug_gnu_pubnames")
45
0
      GnuPubNamesSection = toStringRef(Sec->Data);
46
16
    else if (Sec->Name == ".debug_gnu_pubtypes")
47
0
      GnuPubTypesSection = toStringRef(Sec->Data);
48
16
    else if (Sec->Name == ".debug_str")
49
0
      StrSection = toStringRef(Sec->Data);
50
18
  }
51
13
}
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::LLDDwarfObj(lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)0, false> >*)
Line
Count
Source
28
1
template <class ELFT> LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *Obj) {
29
9
  for (InputSectionBase *Sec : Obj->getSections()) {
30
9
    if (!Sec)
31
4
      continue;
32
5
    if (LLDDWARFSection *M = StringSwitch<LLDDWARFSection *>(Sec->Name)
33
0
                                 .Case(".debug_info", &InfoSection)
34
0
                                 .Case(".debug_ranges", &RangeSection)
35
0
                                 .Case(".debug_line", &LineSection)
36
0
                                 .Default(nullptr)) {
37
0
      Sec->maybeDecompress();
38
0
      M->Data = toStringRef(Sec->Data);
39
0
      M->Sec = Sec;
40
0
      continue;
41
0
    }
42
5
    if (Sec->Name == ".debug_abbrev")
43
0
      AbbrevSection = toStringRef(Sec->Data);
44
5
    else if (Sec->Name == ".debug_gnu_pubnames")
45
0
      GnuPubNamesSection = toStringRef(Sec->Data);
46
5
    else if (Sec->Name == ".debug_gnu_pubtypes")
47
0
      GnuPubTypesSection = toStringRef(Sec->Data);
48
5
    else if (Sec->Name == ".debug_str")
49
0
      StrSection = toStringRef(Sec->Data);
50
5
  }
51
1
}
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::LLDDwarfObj(lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)1, true> >*)
Line
Count
Source
28
159
template <class ELFT> LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *Obj) {
29
1.01k
  for (InputSectionBase *Sec : Obj->getSections()) {
30
1.01k
    if (!Sec)
31
649
      continue;
32
364
    if (LLDDWARFSection *M = StringSwitch<LLDDWARFSection *>(Sec->Name)
33
55
                                 .Case(".debug_info", &InfoSection)
34
55
                                 .Case(".debug_ranges", &RangeSection)
35
55
                                 .Case(".debug_line", &LineSection)
36
55
                                 .Default(nullptr)) {
37
55
      Sec->maybeDecompress();
38
55
      M->Data = toStringRef(Sec->Data);
39
55
      M->Sec = Sec;
40
55
      continue;
41
55
    }
42
309
    if (Sec->Name == ".debug_abbrev")
43
29
      AbbrevSection = toStringRef(Sec->Data);
44
280
    else if (Sec->Name == ".debug_gnu_pubnames")
45
4
      GnuPubNamesSection = toStringRef(Sec->Data);
46
276
    else if (Sec->Name == ".debug_gnu_pubtypes")
47
4
      GnuPubTypesSection = toStringRef(Sec->Data);
48
272
    else if (Sec->Name == ".debug_str")
49
9
      StrSection = toStringRef(Sec->Data);
50
309
  }
51
159
}
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::LLDDwarfObj(lld::elf::ObjFile<llvm::object::ELFType<(llvm::support::endianness)0, true> >*)
Line
Count
Source
28
4
template <class ELFT> LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *Obj) {
29
24
  for (InputSectionBase *Sec : Obj->getSections()) {
30
24
    if (!Sec)
31
16
      continue;
32
8
    if (LLDDWARFSection *M = StringSwitch<LLDDWARFSection *>(Sec->Name)
33
0
                                 .Case(".debug_info", &InfoSection)
34
0
                                 .Case(".debug_ranges", &RangeSection)
35
0
                                 .Case(".debug_line", &LineSection)
36
0
                                 .Default(nullptr)) {
37
0
      Sec->maybeDecompress();
38
0
      M->Data = toStringRef(Sec->Data);
39
0
      M->Sec = Sec;
40
0
      continue;
41
0
    }
42
8
    if (Sec->Name == ".debug_abbrev")
43
0
      AbbrevSection = toStringRef(Sec->Data);
44
8
    else if (Sec->Name == ".debug_gnu_pubnames")
45
0
      GnuPubNamesSection = toStringRef(Sec->Data);
46
8
    else if (Sec->Name == ".debug_gnu_pubtypes")
47
0
      GnuPubTypesSection = toStringRef(Sec->Data);
48
8
    else if (Sec->Name == ".debug_str")
49
0
      StrSection = toStringRef(Sec->Data);
50
8
  }
51
4
}
52
53
// Find if there is a relocation at Pos in Sec.  The code is a bit
54
// more complicated than usual because we need to pass a section index
55
// to llvm since it has no idea about InputSection.
56
template <class ELFT>
57
template <class RelTy>
58
Optional<RelocAddrEntry>
59
LLDDwarfObj<ELFT>::findAux(const InputSectionBase &Sec, uint64_t Pos,
60
137
                           ArrayRef<RelTy> Rels) const {
61
137
  auto It = std::lower_bound(
62
137
      Rels.begin(), Rels.end(), Pos,
63
296
      [](const RelTy &A, uint64_t B) { return A.r_offset < B; });
Unexecuted instantiation: llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, true> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, true> >) const::'lambda'(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, true> const&, unsigned long long)::operator()(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, true> const&, unsigned long long) const
llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, false> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, false> >) const::'lambda'(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, false> const&, unsigned long long)::operator()(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, false> const&, unsigned long long) const
Line
Count
Source
63
16
      [](const RelTy &A, uint64_t B) { return A.r_offset < B; });
Unexecuted instantiation: llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, true> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, true> >) const::'lambda'(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, true> const&, unsigned long long)::operator()(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, true> const&, unsigned long long) const
Unexecuted instantiation: llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, false> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, false> >) const::'lambda'(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, false> const&, unsigned long long)::operator()(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, false> const&, unsigned long long) const
llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, true> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, true> >) const::'lambda'(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, true> const&, unsigned long long)::operator()(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, true> const&, unsigned long long) const
Line
Count
Source
63
280
      [](const RelTy &A, uint64_t B) { return A.r_offset < B; });
Unexecuted instantiation: llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, false> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, false> >) const::'lambda'(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, false> const&, unsigned long long)::operator()(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, false> const&, unsigned long long) const
Unexecuted instantiation: llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, true> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, true> >) const::'lambda'(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, true> const&, unsigned long long)::operator()(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, true> const&, unsigned long long) const
Unexecuted instantiation: llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, false> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, false> >) const::'lambda'(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, false> const&, unsigned long long)::operator()(llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, false> const&, unsigned long long) const
64
137
  if (It == Rels.end() || 
It->r_offset != Pos116
)
65
50
    return None;
66
87
  const RelTy &Rel = *It;
67
87
68
87
  const ObjFile<ELFT> *File = Sec.getFile<ELFT>();
69
87
  uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
70
87
  const typename ELFT::Sym &Sym = File->getELFSyms()[SymIndex];
71
87
  uint32_t SecIndex = File->getSectionIndex(Sym);
72
87
73
87
  // Broken debug info can point to a non-Defined symbol.
74
87
  auto *DR = dyn_cast<Defined>(&File->getRelocTargetSym(Rel));
75
87
  if (!DR) {
76
3
    error("unsupported relocation target while parsing debug info");
77
3
    return None;
78
3
  }
79
84
  uint64_t Val = DR->Value + getAddend<ELFT>(Rel);
80
84
81
84
  // FIXME: We should be consistent about always adding the file
82
84
  // offset or not.
83
84
  if (DR->Section->Flags & ELF::SHF_ALLOC)
84
30
    Val += cast<InputSection>(DR->Section)->getOffsetInFile();
85
84
86
84
  return RelocAddrEntry{SecIndex, Val};
87
84
}
Unexecuted instantiation: llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, true> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, true> >) const
llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, false> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, false>, false> >) const
Line
Count
Source
60
9
                           ArrayRef<RelTy> Rels) const {
61
9
  auto It = std::lower_bound(
62
9
      Rels.begin(), Rels.end(), Pos,
63
9
      [](const RelTy &A, uint64_t B) { return A.r_offset < B; });
64
9
  if (It == Rels.end() || It->r_offset != Pos)
65
3
    return None;
66
6
  const RelTy &Rel = *It;
67
6
68
6
  const ObjFile<ELFT> *File = Sec.getFile<ELFT>();
69
6
  uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
70
6
  const typename ELFT::Sym &Sym = File->getELFSyms()[SymIndex];
71
6
  uint32_t SecIndex = File->getSectionIndex(Sym);
72
6
73
6
  // Broken debug info can point to a non-Defined symbol.
74
6
  auto *DR = dyn_cast<Defined>(&File->getRelocTargetSym(Rel));
75
6
  if (!DR) {
76
0
    error("unsupported relocation target while parsing debug info");
77
0
    return None;
78
0
  }
79
6
  uint64_t Val = DR->Value + getAddend<ELFT>(Rel);
80
6
81
6
  // FIXME: We should be consistent about always adding the file
82
6
  // offset or not.
83
6
  if (DR->Section->Flags & ELF::SHF_ALLOC)
84
2
    Val += cast<InputSection>(DR->Section)->getOffsetInFile();
85
6
86
6
  return RelocAddrEntry{SecIndex, Val};
87
6
}
Unexecuted instantiation: llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, true> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, true> >) const
Unexecuted instantiation: llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, false> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, false>, false> >) const
llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, true> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, true> >) const
Line
Count
Source
60
122
                           ArrayRef<RelTy> Rels) const {
61
122
  auto It = std::lower_bound(
62
122
      Rels.begin(), Rels.end(), Pos,
63
122
      [](const RelTy &A, uint64_t B) { return A.r_offset < B; });
64
122
  if (It == Rels.end() || 
It->r_offset != Pos107
)
65
41
    return None;
66
81
  const RelTy &Rel = *It;
67
81
68
81
  const ObjFile<ELFT> *File = Sec.getFile<ELFT>();
69
81
  uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
70
81
  const typename ELFT::Sym &Sym = File->getELFSyms()[SymIndex];
71
81
  uint32_t SecIndex = File->getSectionIndex(Sym);
72
81
73
81
  // Broken debug info can point to a non-Defined symbol.
74
81
  auto *DR = dyn_cast<Defined>(&File->getRelocTargetSym(Rel));
75
81
  if (!DR) {
76
3
    error("unsupported relocation target while parsing debug info");
77
3
    return None;
78
3
  }
79
78
  uint64_t Val = DR->Value + getAddend<ELFT>(Rel);
80
78
81
78
  // FIXME: We should be consistent about always adding the file
82
78
  // offset or not.
83
78
  if (DR->Section->Flags & ELF::SHF_ALLOC)
84
28
    Val += cast<InputSection>(DR->Section)->getOffsetInFile();
85
78
86
78
  return RelocAddrEntry{SecIndex, Val};
87
78
}
llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, false> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)1, true>, false> >) const
Line
Count
Source
60
6
                           ArrayRef<RelTy> Rels) const {
61
6
  auto It = std::lower_bound(
62
6
      Rels.begin(), Rels.end(), Pos,
63
6
      [](const RelTy &A, uint64_t B) { return A.r_offset < B; });
64
6
  if (It == Rels.end() || 
It->r_offset != Pos0
)
65
6
    return None;
66
0
  const RelTy &Rel = *It;
67
0
68
0
  const ObjFile<ELFT> *File = Sec.getFile<ELFT>();
69
0
  uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
70
0
  const typename ELFT::Sym &Sym = File->getELFSyms()[SymIndex];
71
0
  uint32_t SecIndex = File->getSectionIndex(Sym);
72
0
73
0
  // Broken debug info can point to a non-Defined symbol.
74
0
  auto *DR = dyn_cast<Defined>(&File->getRelocTargetSym(Rel));
75
0
  if (!DR) {
76
0
    error("unsupported relocation target while parsing debug info");
77
0
    return None;
78
0
  }
79
0
  uint64_t Val = DR->Value + getAddend<ELFT>(Rel);
80
0
81
0
  // FIXME: We should be consistent about always adding the file
82
0
  // offset or not.
83
0
  if (DR->Section->Flags & ELF::SHF_ALLOC)
84
0
    Val += cast<InputSection>(DR->Section)->getOffsetInFile();
85
0
86
0
  return RelocAddrEntry{SecIndex, Val};
87
0
}
Unexecuted instantiation: llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, true> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, true> >) const
Unexecuted instantiation: llvm::Optional<llvm::RelocAddrEntry> lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::findAux<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, false> >(lld::elf::InputSectionBase const&, unsigned long long, llvm::ArrayRef<llvm::object::Elf_Rel_Impl<llvm::object::ELFType<(llvm::support::endianness)0, true>, false> >) const
88
89
template <class ELFT>
90
Optional<RelocAddrEntry> LLDDwarfObj<ELFT>::find(const llvm::DWARFSection &S,
91
138
                                                 uint64_t Pos) const {
92
138
  auto &Sec = static_cast<const LLDDWARFSection &>(S);
93
138
  if (Sec.Sec->AreRelocsRela)
94
123
    return findAux(*Sec.Sec, Pos, Sec.Sec->template relas<ELFT>());
95
15
  return findAux(*Sec.Sec, Pos, Sec.Sec->template rels<ELFT>());
96
15
}
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::find(llvm::DWARFSection const&, unsigned long long) const
Line
Count
Source
91
9
                                                 uint64_t Pos) const {
92
9
  auto &Sec = static_cast<const LLDDWARFSection &>(S);
93
9
  if (Sec.Sec->AreRelocsRela)
94
0
    return findAux(*Sec.Sec, Pos, Sec.Sec->template relas<ELFT>());
95
9
  return findAux(*Sec.Sec, Pos, Sec.Sec->template rels<ELFT>());
96
9
}
Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::find(llvm::DWARFSection const&, unsigned long long) const
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::find(llvm::DWARFSection const&, unsigned long long) const
Line
Count
Source
91
129
                                                 uint64_t Pos) const {
92
129
  auto &Sec = static_cast<const LLDDWARFSection &>(S);
93
129
  if (Sec.Sec->AreRelocsRela)
94
123
    return findAux(*Sec.Sec, Pos, Sec.Sec->template relas<ELFT>());
95
6
  return findAux(*Sec.Sec, Pos, Sec.Sec->template rels<ELFT>());
96
6
}
Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::find(llvm::DWARFSection const&, unsigned long long) const
97
98
template class elf::LLDDwarfObj<ELF32LE>;
99
template class elf::LLDDwarfObj<ELF32BE>;
100
template class elf::LLDDwarfObj<ELF64LE>;
101
template class elf::LLDDwarfObj<ELF64BE>;