Coverage Report

Created: 2018-06-25 02:00

/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
171
template <class ELFT> LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *Obj) {
29
1.07k
  for (InputSectionBase *Sec : Obj->getSections()) {
30
1.07k
    if (!Sec)
31
700
      continue;
32
376
    if (LLDDWARFSection *M = StringSwitch<LLDDWARFSection *>(Sec->Name)
33
56
                                 .Case(".debug_info", &InfoSection)
34
56
                                 .Case(".debug_ranges", &RangeSection)
35
56
                                 .Case(".debug_line", &LineSection)
36
56
                                 .Default(nullptr)) {
37
56
      Sec->maybeDecompress();
38
56
      M->Data = toStringRef(Sec->Data);
39
56
      M->Sec = Sec;
40
56
      continue;
41
56
    }
42
320
    if (Sec->Name == ".debug_abbrev")
43
29
      AbbrevSection = toStringRef(Sec->Data);
44
291
    else if (Sec->Name == ".debug_gnu_pubnames")
45
4
      GnuPubNamesSection = toStringRef(Sec->Data);
46
287
    else if (Sec->Name == ".debug_gnu_pubtypes")
47
5
      GnuPubTypesSection = toStringRef(Sec->Data);
48
282
    else if (Sec->Name == ".debug_str")
49
9
      StrSection = toStringRef(Sec->Data);
50
320
  }
51
171
}
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
153
template <class ELFT> LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *Obj) {
29
962
  for (InputSectionBase *Sec : Obj->getSections()) {
30
962
    if (!Sec)
31
623
      continue;
32
339
    if (LLDDWARFSection *M = StringSwitch<LLDDWARFSection *>(Sec->Name)
33
50
                                 .Case(".debug_info", &InfoSection)
34
50
                                 .Case(".debug_ranges", &RangeSection)
35
50
                                 .Case(".debug_line", &LineSection)
36
50
                                 .Default(nullptr)) {
37
50
      Sec->maybeDecompress();
38
50
      M->Data = toStringRef(Sec->Data);
39
50
      M->Sec = Sec;
40
50
      continue;
41
50
    }
42
289
    if (Sec->Name == ".debug_abbrev")
43
27
      AbbrevSection = toStringRef(Sec->Data);
44
262
    else if (Sec->Name == ".debug_gnu_pubnames")
45
4
      GnuPubNamesSection = toStringRef(Sec->Data);
46
258
    else if (Sec->Name == ".debug_gnu_pubtypes")
47
5
      GnuPubTypesSection = toStringRef(Sec->Data);
48
253
    else if (Sec->Name == ".debug_str")
49
9
      StrSection = toStringRef(Sec->Data);
50
289
  }
51
153
}
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
128
                           ArrayRef<RelTy> Rels) const {
61
128
  auto It = std::lower_bound(
62
128
      Rels.begin(), Rels.end(), Pos,
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, 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
14
      [](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
266
      [](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
128
  if (It == Rels.end() || 
It->r_offset != Pos109
)
65
43
    return None;
66
85
  const RelTy &Rel = *It;
67
85
68
85
  const ObjFile<ELFT> *File = Sec.getFile<ELFT>();
69
85
  uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
70
85
  const typename ELFT::Sym &Sym = File->getELFSyms()[SymIndex];
71
85
  uint32_t SecIndex = File->getSectionIndex(Sym);
72
85
73
85
  // Broken debug info can point to a non-Defined symbol.
74
85
  auto *DR = dyn_cast<Defined>(&File->getRelocTargetSym(Rel));
75
85
  if (!DR) {
76
3
    error("unsupported relocation target while parsing debug info");
77
3
    return None;
78
3
  }
79
82
  uint64_t Val = DR->Value + getAddend<ELFT>(Rel);
80
82
81
82
  // FIXME: We should be consistent about always adding the file
82
82
  // offset or not.
83
82
  if (DR->Section->Flags & ELF::SHF_ALLOC)
84
29
    Val += cast<InputSection>(DR->Section)->getOffsetInFile();
85
82
86
82
  return RelocAddrEntry{SecIndex, Val};
87
82
}
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
8
                           ArrayRef<RelTy> Rels) const {
61
8
  auto It = std::lower_bound(
62
8
      Rels.begin(), Rels.end(), Pos,
63
8
      [](const RelTy &A, uint64_t B) { return A.r_offset < B; });
64
8
  if (It == Rels.end() || It->r_offset != Pos)
65
2
    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
114
                           ArrayRef<RelTy> Rels) const {
61
114
  auto It = std::lower_bound(
62
114
      Rels.begin(), Rels.end(), Pos,
63
114
      [](const RelTy &A, uint64_t B) { return A.r_offset < B; });
64
114
  if (It == Rels.end() || 
It->r_offset != Pos101
)
65
35
    return None;
66
79
  const RelTy &Rel = *It;
67
79
68
79
  const ObjFile<ELFT> *File = Sec.getFile<ELFT>();
69
79
  uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
70
79
  const typename ELFT::Sym &Sym = File->getELFSyms()[SymIndex];
71
79
  uint32_t SecIndex = File->getSectionIndex(Sym);
72
79
73
79
  // Broken debug info can point to a non-Defined symbol.
74
79
  auto *DR = dyn_cast<Defined>(&File->getRelocTargetSym(Rel));
75
79
  if (!DR) {
76
3
    error("unsupported relocation target while parsing debug info");
77
3
    return None;
78
3
  }
79
76
  uint64_t Val = DR->Value + getAddend<ELFT>(Rel);
80
76
81
76
  // FIXME: We should be consistent about always adding the file
82
76
  // offset or not.
83
76
  if (DR->Section->Flags & ELF::SHF_ALLOC)
84
27
    Val += cast<InputSection>(DR->Section)->getOffsetInFile();
85
76
86
76
  return RelocAddrEntry{SecIndex, Val};
87
76
}
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
129
                                                 uint64_t Pos) const {
92
129
  auto &Sec = static_cast<const LLDDWARFSection &>(S);
93
129
  if (Sec.Sec->AreRelocsRela)
94
115
    return findAux(*Sec.Sec, Pos, Sec.Sec->template relas<ELFT>());
95
14
  return findAux(*Sec.Sec, Pos, Sec.Sec->template rels<ELFT>());
96
14
}
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::find(llvm::DWARFSection const&, unsigned long long) const
Line
Count
Source
91
8
                                                 uint64_t Pos) const {
92
8
  auto &Sec = static_cast<const LLDDWARFSection &>(S);
93
8
  if (Sec.Sec->AreRelocsRela)
94
0
    return findAux(*Sec.Sec, Pos, Sec.Sec->template relas<ELFT>());
95
8
  return findAux(*Sec.Sec, Pos, Sec.Sec->template rels<ELFT>());
96
8
}
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
121
                                                 uint64_t Pos) const {
92
121
  auto &Sec = static_cast<const LLDDWARFSection &>(S);
93
121
  if (Sec.Sec->AreRelocsRela)
94
115
    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>;