Coverage Report

Created: 2018-01-17 17:22

/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
155
template <class ELFT> LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *Obj) {
29
922
  for (InputSectionBase *Sec : Obj->getSections()) {
30
922
    if (!Sec)
31
615
      continue;
32
307
    if (LLDDWARFSection *M = StringSwitch<LLDDWARFSection *>(Sec->Name)
33
35
                                 .Case(".debug_info", &InfoSection)
34
35
                                 .Case(".debug_ranges", &RangeSection)
35
35
                                 .Case(".debug_line", &LineSection)
36
35
                                 .Default(nullptr)) {
37
35
      Sec->maybeUncompress();
38
35
      M->Data = toStringRef(Sec->Data);
39
35
      M->Sec = Sec;
40
35
      continue;
41
35
    }
42
272
    if (Sec->Name == ".debug_abbrev")
43
15
      AbbrevSection = toStringRef(Sec->Data);
44
257
    else if (Sec->Name == ".debug_gnu_pubnames")
45
2
      GnuPubNamesSection = toStringRef(Sec->Data);
46
255
    else if (Sec->Name == ".debug_gnu_pubtypes")
47
3
      GnuPubTypesSection = toStringRef(Sec->Data);
48
252
    else if (Sec->Name == ".debug_str")
49
5
      StrSection = toStringRef(Sec->Data);
50
272
  }
51
155
}
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
12
template <class ELFT> LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *Obj) {
29
70
  for (InputSectionBase *Sec : Obj->getSections()) {
30
70
    if (!Sec)
31
51
      continue;
32
19
    if (LLDDWARFSection *M = StringSwitch<LLDDWARFSection *>(Sec->Name)
33
4
                                 .Case(".debug_info", &InfoSection)
34
4
                                 .Case(".debug_ranges", &RangeSection)
35
4
                                 .Case(".debug_line", &LineSection)
36
4
                                 .Default(nullptr)) {
37
4
      Sec->maybeUncompress();
38
4
      M->Data = toStringRef(Sec->Data);
39
4
      M->Sec = Sec;
40
4
      continue;
41
4
    }
42
15
    if (Sec->Name == ".debug_abbrev")
43
0
      AbbrevSection = toStringRef(Sec->Data);
44
15
    else if (Sec->Name == ".debug_gnu_pubnames")
45
0
      GnuPubNamesSection = toStringRef(Sec->Data);
46
15
    else if (Sec->Name == ".debug_gnu_pubtypes")
47
0
      GnuPubTypesSection = toStringRef(Sec->Data);
48
15
    else if (Sec->Name == ".debug_str")
49
0
      StrSection = toStringRef(Sec->Data);
50
15
  }
51
12
}
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->maybeUncompress();
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
140
template <class ELFT> LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *Obj) {
29
829
  for (InputSectionBase *Sec : Obj->getSections()) {
30
829
    if (!Sec)
31
552
      continue;
32
277
    if (LLDDWARFSection *M = StringSwitch<LLDDWARFSection *>(Sec->Name)
33
31
                                 .Case(".debug_info", &InfoSection)
34
31
                                 .Case(".debug_ranges", &RangeSection)
35
31
                                 .Case(".debug_line", &LineSection)
36
31
                                 .Default(nullptr)) {
37
31
      Sec->maybeUncompress();
38
31
      M->Data = toStringRef(Sec->Data);
39
31
      M->Sec = Sec;
40
31
      continue;
41
31
    }
42
246
    if (Sec->Name == ".debug_abbrev")
43
15
      AbbrevSection = toStringRef(Sec->Data);
44
231
    else if (Sec->Name == ".debug_gnu_pubnames")
45
2
      GnuPubNamesSection = toStringRef(Sec->Data);
46
229
    else if (Sec->Name == ".debug_gnu_pubtypes")
47
3
      GnuPubTypesSection = toStringRef(Sec->Data);
48
226
    else if (Sec->Name == ".debug_str")
49
5
      StrSection = toStringRef(Sec->Data);
50
246
  }
51
140
}
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
2
template <class ELFT> LLDDwarfObj<ELFT>::LLDDwarfObj(ObjFile<ELFT> *Obj) {
29
14
  for (InputSectionBase *Sec : Obj->getSections()) {
30
14
    if (!Sec)
31
8
      continue;
32
6
    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->maybeUncompress();
38
0
      M->Data = toStringRef(Sec->Data);
39
0
      M->Sec = Sec;
40
0
      continue;
41
0
    }
42
6
    if (Sec->Name == ".debug_abbrev")
43
0
      AbbrevSection = toStringRef(Sec->Data);
44
6
    else if (Sec->Name == ".debug_gnu_pubnames")
45
0
      GnuPubNamesSection = toStringRef(Sec->Data);
46
6
    else if (Sec->Name == ".debug_gnu_pubtypes")
47
0
      GnuPubTypesSection = toStringRef(Sec->Data);
48
6
    else if (Sec->Name == ".debug_str")
49
0
      StrSection = toStringRef(Sec->Data);
50
6
  }
51
2
}
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
55
                           ArrayRef<RelTy> Rels) const {
61
55
  auto It = std::lower_bound(
62
55
      Rels.begin(), Rels.end(), Pos,
63
98
      [](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
2
      [](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
96
      [](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
55
  if (It == Rels.end() || 
It->r_offset != Pos41
)
65
20
    return None;
66
35
  const RelTy &Rel = *It;
67
35
68
35
  const ObjFile<ELFT> *File = Sec.getFile<ELFT>();
69
35
  uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
70
35
  const typename ELFT::Sym &Sym = File->getELFSyms()[SymIndex];
71
35
  uint32_t SecIndex = File->getSectionIndex(Sym);
72
35
73
35
  // Broken debug info can point to a non-Defined symbol.
74
35
  auto *DR = dyn_cast<Defined>(&File->getRelocTargetSym(Rel));
75
35
  if (!DR) {
76
1
    error("unsupported relocation target while parsing debug info");
77
1
    return None;
78
1
  }
79
34
  uint64_t Val = DR->Value + getAddend<ELFT>(Rel);
80
34
81
34
  // FIXME: We should be consistent about always adding the file
82
34
  // offset or not.
83
34
  if (DR->Section->Flags & ELF::SHF_ALLOC)
84
26
    Val += cast<InputSection>(DR->Section)->getOffsetInFile();
85
34
86
34
  return RelocAddrEntry{SecIndex, Val};
87
34
}
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
2
                           ArrayRef<RelTy> Rels) const {
61
2
  auto It = std::lower_bound(
62
2
      Rels.begin(), Rels.end(), Pos,
63
2
      [](const RelTy &A, uint64_t B) { return A.r_offset < B; });
64
2
  if (It == Rels.end() || It->r_offset != Pos)
65
0
    return None;
66
2
  const RelTy &Rel = *It;
67
2
68
2
  const ObjFile<ELFT> *File = Sec.getFile<ELFT>();
69
2
  uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
70
2
  const typename ELFT::Sym &Sym = File->getELFSyms()[SymIndex];
71
2
  uint32_t SecIndex = File->getSectionIndex(Sym);
72
2
73
2
  // Broken debug info can point to a non-Defined symbol.
74
2
  auto *DR = dyn_cast<Defined>(&File->getRelocTargetSym(Rel));
75
2
  if (!DR) {
76
0
    error("unsupported relocation target while parsing debug info");
77
0
    return None;
78
0
  }
79
2
  uint64_t Val = DR->Value + getAddend<ELFT>(Rel);
80
2
81
2
  // FIXME: We should be consistent about always adding the file
82
2
  // offset or not.
83
2
  if (DR->Section->Flags & ELF::SHF_ALLOC)
84
2
    Val += cast<InputSection>(DR->Section)->getOffsetInFile();
85
2
86
2
  return RelocAddrEntry{SecIndex, Val};
87
2
}
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
47
                           ArrayRef<RelTy> Rels) const {
61
47
  auto It = std::lower_bound(
62
47
      Rels.begin(), Rels.end(), Pos,
63
47
      [](const RelTy &A, uint64_t B) { return A.r_offset < B; });
64
47
  if (It == Rels.end() || 
It->r_offset != Pos39
)
65
14
    return None;
66
33
  const RelTy &Rel = *It;
67
33
68
33
  const ObjFile<ELFT> *File = Sec.getFile<ELFT>();
69
33
  uint32_t SymIndex = Rel.getSymbol(Config->IsMips64EL);
70
33
  const typename ELFT::Sym &Sym = File->getELFSyms()[SymIndex];
71
33
  uint32_t SecIndex = File->getSectionIndex(Sym);
72
33
73
33
  // Broken debug info can point to a non-Defined symbol.
74
33
  auto *DR = dyn_cast<Defined>(&File->getRelocTargetSym(Rel));
75
33
  if (!DR) {
76
1
    error("unsupported relocation target while parsing debug info");
77
1
    return None;
78
1
  }
79
32
  uint64_t Val = DR->Value + getAddend<ELFT>(Rel);
80
32
81
32
  // FIXME: We should be consistent about always adding the file
82
32
  // offset or not.
83
32
  if (DR->Section->Flags & ELF::SHF_ALLOC)
84
24
    Val += cast<InputSection>(DR->Section)->getOffsetInFile();
85
32
86
32
  return RelocAddrEntry{SecIndex, Val};
87
32
}
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
56
                                                 uint64_t Pos) const {
92
56
  auto &Sec = static_cast<const LLDDWARFSection &>(S);
93
56
  if (Sec.Sec->AreRelocsRela)
94
47
    return findAux(*Sec.Sec, Pos, Sec.Sec->template relas<ELFT>());
95
9
  return findAux(*Sec.Sec, Pos, Sec.Sec->template rels<ELFT>());
96
9
}
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::find(llvm::DWARFSection const&, unsigned long long) const
Line
Count
Source
91
2
                                                 uint64_t Pos) const {
92
2
  auto &Sec = static_cast<const LLDDWARFSection &>(S);
93
2
  if (Sec.Sec->AreRelocsRela)
94
0
    return findAux(*Sec.Sec, Pos, Sec.Sec->template relas<ELFT>());
95
2
  return findAux(*Sec.Sec, Pos, Sec.Sec->template rels<ELFT>());
96
2
}
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
54
                                                 uint64_t Pos) const {
92
54
  auto &Sec = static_cast<const LLDDWARFSection &>(S);
93
54
  if (Sec.Sec->AreRelocsRela)
94
47
    return findAux(*Sec.Sec, Pos, Sec.Sec->template relas<ELFT>());
95
7
  return findAux(*Sec.Sec, Pos, Sec.Sec->template rels<ELFT>());
96
7
}
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>;