Coverage Report

Created: 2018-01-17 21:32

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/ELF/Target.h
Line
Count
Source (jump to first uncovered line)
1
//===- Target.h -------------------------------------------------*- C++ -*-===//
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
#ifndef LLD_ELF_TARGET_H
11
#define LLD_ELF_TARGET_H
12
13
#include "InputSection.h"
14
#include "lld/Common/ErrorHandler.h"
15
#include "llvm/Object/ELF.h"
16
17
namespace lld {
18
std::string toString(elf::RelType Type);
19
20
namespace elf {
21
class Defined;
22
class InputFile;
23
class Symbol;
24
25
class TargetInfo {
26
public:
27
801
  virtual uint32_t calcEFlags() const { return 0; }
28
24
  virtual bool isPicRel(RelType Type) const { return true; }
29
40
  virtual RelType getDynRel(RelType Type) const { return Type; }
30
18
  virtual void writeGotPltHeader(uint8_t *Buf) const {}
31
1
  virtual void writeGotPlt(uint8_t *Buf, const Symbol &S) const {};
32
  virtual void writeIgotPlt(uint8_t *Buf, const Symbol &S) const;
33
  virtual int64_t getImplicitAddend(const uint8_t *Buf, RelType Type) const;
34
35
  // If lazy binding is supported, the first entry of the PLT has code
36
  // to call the dynamic linker to resolve PLT entries the first time
37
  // they are called. This function writes that code.
38
1
  virtual void writePltHeader(uint8_t *Buf) const {}
39
40
  virtual void writePlt(uint8_t *Buf, uint64_t GotEntryAddr,
41
                        uint64_t PltEntryAddr, int32_t Index,
42
0
                        unsigned RelOff) const {}
43
78
  virtual void addPltHeaderSymbols(InputSection &IS) const {}
44
122
  virtual void addPltSymbols(InputSection &IS, uint64_t Off) const {}
45
46
  // Returns true if a relocation only uses the low bits of a value such that
47
  // all those bits are in in the same page. For example, if the relocation
48
  // only uses the low 12 bits in a system with 4k pages. If this is true, the
49
  // bits will always have the same value at runtime and we don't have to emit
50
  // a dynamic relocation.
51
  virtual bool usesOnlyLowPageBits(RelType Type) const;
52
53
  // Decide whether a Thunk is needed for the relocation from File
54
  // targeting S.
55
  virtual bool needsThunk(RelExpr Expr, RelType RelocType,
56
                          const InputFile *File, uint64_t BranchAddr,
57
                          const Symbol &S) const;
58
  // Return true if we can reach Dst from Src with Relocation RelocType
59
  virtual bool inBranchRange(RelType Type, uint64_t Src,
60
                             uint64_t Dst) const;
61
  virtual RelExpr getRelExpr(RelType Type, const Symbol &S,
62
                             const uint8_t *Loc) const = 0;
63
64
  virtual void relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const = 0;
65
66
  virtual ~TargetInfo();
67
68
  unsigned TlsGdRelaxSkip = 1;
69
  unsigned PageSize = 4096;
70
  unsigned DefaultMaxPageSize = 4096;
71
72
  uint64_t getImageBase();
73
74
  // Offset of _GLOBAL_OFFSET_TABLE_ from base of .got section. Use -1 for
75
  // end of .got
76
  uint64_t GotBaseSymOff = 0;
77
78
  // On systems with range extensions we place collections of Thunks at
79
  // regular spacings that enable the majority of branches reach the Thunks.
80
  uint32_t ThunkSectionSpacing = 0;
81
82
  RelType CopyRel;
83
  RelType GotRel;
84
  RelType PltRel;
85
  RelType RelativeRel;
86
  RelType IRelativeRel;
87
  RelType TlsDescRel;
88
  RelType TlsGotRel;
89
  RelType TlsModuleIndexRel;
90
  RelType TlsOffsetRel;
91
  unsigned GotEntrySize = 0;
92
  unsigned GotPltEntrySize = 0;
93
  unsigned PltEntrySize;
94
  unsigned PltHeaderSize;
95
96
  // At least on x86_64 positions 1 and 2 are used by the first plt entry
97
  // to support lazy loading.
98
  unsigned GotPltHeaderEntriesNum = 3;
99
100
  // Set to 0 for variant 2
101
  unsigned TcbSize = 0;
102
103
  bool NeedsThunks = false;
104
105
  // A 4-byte field corresponding to one or more trap instructions, used to pad
106
  // executable OutputSections.
107
  uint32_t TrapInstr = 0;
108
109
  virtual RelExpr adjustRelaxExpr(RelType Type, const uint8_t *Data,
110
                                  RelExpr Expr) const;
111
  virtual void relaxGot(uint8_t *Loc, uint64_t Val) const;
112
  virtual void relaxTlsGdToIe(uint8_t *Loc, RelType Type, uint64_t Val) const;
113
  virtual void relaxTlsGdToLe(uint8_t *Loc, RelType Type, uint64_t Val) const;
114
  virtual void relaxTlsIeToLe(uint8_t *Loc, RelType Type, uint64_t Val) const;
115
  virtual void relaxTlsLdToLe(uint8_t *Loc, RelType Type, uint64_t Val) const;
116
117
protected:
118
  // On FreeBSD x86_64 the first page cannot be mmaped.
119
  // On Linux that is controled by vm.mmap_min_addr. At least on some x86_64
120
  // installs that is 65536, so the first 15 pages cannot be used.
121
  // Given that, the smallest value that can be used in here is 0x10000.
122
  uint64_t DefaultImageBase = 0x10000;
123
};
124
125
TargetInfo *getAArch64TargetInfo();
126
TargetInfo *getAMDGPUTargetInfo();
127
TargetInfo *getARMTargetInfo();
128
TargetInfo *getAVRTargetInfo();
129
TargetInfo *getPPC64TargetInfo();
130
TargetInfo *getPPCTargetInfo();
131
TargetInfo *getSPARCV9TargetInfo();
132
TargetInfo *getX32TargetInfo();
133
TargetInfo *getX86TargetInfo();
134
TargetInfo *getX86_64TargetInfo();
135
template <class ELFT> TargetInfo *getMipsTargetInfo();
136
137
std::string getErrorLocation(const uint8_t *Loc);
138
139
uint64_t getPPC64TocBase();
140
uint64_t getAArch64Page(uint64_t Expr);
141
142
extern TargetInfo *Target;
143
TargetInfo *getTarget();
144
145
template <class ELFT> bool isMipsPIC(const Defined *Sym);
146
147
static inline void reportRangeError(uint8_t *Loc, RelType Type, const Twine &V,
148
1.82k
                                    int64_t Min, uint64_t Max) {
149
1.82k
  error(getErrorLocation(Loc) + "relocation " + lld::toString(Type) +
150
1.82k
        " out of range: " + V + " is not in [" + Twine(Min) + ", " +
151
1.82k
        Twine(Max) + "]");
152
1.82k
}
Unexecuted instantiation: AArch64ErrataFix.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
AArch64.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Line
Count
Source
148
4
                                    int64_t Min, uint64_t Max) {
149
4
  error(getErrorLocation(Loc) + "relocation " + lld::toString(Type) +
150
4
        " out of range: " + V + " is not in [" + Twine(Min) + ", " +
151
4
        Twine(Max) + "]");
152
4
}
Unexecuted instantiation: AMDGPU.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: ARM.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: AVR.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Mips.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Line
Count
Source
148
1.81k
                                    int64_t Min, uint64_t Max) {
149
1.81k
  error(getErrorLocation(Loc) + "relocation " + lld::toString(Type) +
150
1.81k
        " out of range: " + V + " is not in [" + Twine(Min) + ", " +
151
1.81k
        Twine(Max) + "]");
152
1.81k
}
Unexecuted instantiation: PPC.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
PPC64.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Line
Count
Source
148
1
                                    int64_t Min, uint64_t Max) {
149
1
  error(getErrorLocation(Loc) + "relocation " + lld::toString(Type) +
150
1
        " out of range: " + V + " is not in [" + Twine(Min) + ", " +
151
1
        Twine(Max) + "]");
152
1
}
Unexecuted instantiation: SPARCV9.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: X86.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
X86_64.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Line
Count
Source
148
6
                                    int64_t Min, uint64_t Max) {
149
6
  error(getErrorLocation(Loc) + "relocation " + lld::toString(Type) +
150
6
        " out of range: " + V + " is not in [" + Twine(Min) + ", " +
151
6
        Twine(Max) + "]");
152
6
}
Unexecuted instantiation: Driver.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: InputSection.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: LinkerScript.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: MarkLive.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: OutputSections.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: Relocations.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: ScriptParser.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: Symbols.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: SyntheticSections.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: Target.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: Thunks.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
Unexecuted instantiation: Writer.cpp:lld::elf::reportRangeError(unsigned char*, unsigned int, llvm::Twine const&, long long, unsigned long long)
153
154
template <unsigned N>
155
10.8k
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
10.8k
  if (!llvm::isInt<N>(V))
157
1.81k
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
10.8k
}
AArch64.cpp:void lld::elf::checkInt<33u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
48
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
48
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
48
}
AArch64.cpp:void lld::elf::checkInt<21u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
9
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
9
  if (!llvm::isInt<N>(V))
157
1
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
9
}
AArch64.cpp:void lld::elf::checkInt<28u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
71
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
71
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
71
}
AArch64.cpp:void lld::elf::checkInt<16u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
4
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
4
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
4
}
AArch64.cpp:void lld::elf::checkInt<24u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
2
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
2
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
2
}
ARM.cpp:void lld::elf::checkInt<31u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
63
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
63
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
63
}
ARM.cpp:void lld::elf::checkInt<26u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
86
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
86
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
86
}
Unexecuted instantiation: ARM.cpp:void lld::elf::checkInt<12u>(unsigned char*, long long, unsigned int)
ARM.cpp:void lld::elf::checkInt<21u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
7
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
7
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
7
}
ARM.cpp:void lld::elf::checkInt<25u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
44
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
44
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
44
}
ARM.cpp:void lld::elf::checkInt<32u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
54
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
54
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
54
}
Mips.cpp:void lld::elf::checkInt<16u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
10.0k
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
10.0k
  if (!llvm::isInt<N>(V))
157
1.81k
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
10.0k
}
Unexecuted instantiation: Mips.cpp:void lld::elf::checkInt<7u>(unsigned char*, long long, unsigned int)
Mips.cpp:void lld::elf::checkInt<18u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
1
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
1
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
1
}
Mips.cpp:void lld::elf::checkInt<21u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
3
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
3
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
3
}
Mips.cpp:void lld::elf::checkInt<23u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
1
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
1
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
1
}
Mips.cpp:void lld::elf::checkInt<28u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
1
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
1
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
1
}
Mips.cpp:void lld::elf::checkInt<27u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
7
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
7
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
7
}
Mips.cpp:void lld::elf::checkInt<8u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
1
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
1
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
1
}
Mips.cpp:void lld::elf::checkInt<11u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
1
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
1
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
1
}
Mips.cpp:void lld::elf::checkInt<17u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
1
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
1
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
1
}
Unexecuted instantiation: Mips.cpp:void lld::elf::checkInt<22u>(unsigned char*, long long, unsigned int)
Mips.cpp:void lld::elf::checkInt<25u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
4
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
4
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
4
}
PPC64.cpp:void lld::elf::checkInt<16u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
1
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
1
  if (!llvm::isInt<N>(V))
157
1
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
1
}
Unexecuted instantiation: PPC64.cpp:void lld::elf::checkInt<32u>(unsigned char*, long long, unsigned int)
PPC64.cpp:void lld::elf::checkInt<24u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
3
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
3
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
3
}
Unexecuted instantiation: SPARCV9.cpp:void lld::elf::checkInt<32u>(unsigned char*, long long, unsigned int)
Unexecuted instantiation: SPARCV9.cpp:void lld::elf::checkInt<21u>(unsigned char*, long long, unsigned int)
X86.cpp:void lld::elf::checkInt<8u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
2
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
2
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
2
}
X86.cpp:void lld::elf::checkInt<17u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
1
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
1
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
1
}
X86.cpp:void lld::elf::checkInt<32u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
72
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
72
  if (!llvm::isInt<N>(V))
157
0
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
72
}
X86_64.cpp:void lld::elf::checkInt<32u>(unsigned char*, long long, unsigned int)
Line
Count
Source
155
358
static void checkInt(uint8_t *Loc, int64_t V, RelType Type) {
156
358
  if (!llvm::isInt<N>(V))
157
3
    reportRangeError(Loc, Type, Twine(V), llvm::minIntN(N), llvm::maxIntN(N));
158
358
}
159
160
template <unsigned N>
161
67
static void checkUInt(uint8_t *Loc, uint64_t V, RelType Type) {
162
67
  if (!llvm::isUInt<N>(V))
163
3
    reportRangeError(Loc, Type, Twine(V), 0, llvm::maxUIntN(N));
164
67
}
AArch64.cpp:void lld::elf::checkUInt<32u>(unsigned char*, unsigned long long, unsigned int)
Line
Count
Source
161
7
static void checkUInt(uint8_t *Loc, uint64_t V, RelType Type) {
162
7
  if (!llvm::isUInt<N>(V))
163
0
    reportRangeError(Loc, Type, Twine(V), 0, llvm::maxUIntN(N));
164
7
}
Unexecuted instantiation: SPARCV9.cpp:void lld::elf::checkUInt<32u>(unsigned char*, unsigned long long, unsigned int)
Unexecuted instantiation: SPARCV9.cpp:void lld::elf::checkUInt<22u>(unsigned char*, unsigned long long, unsigned int)
X86.cpp:void lld::elf::checkUInt<8u>(unsigned char*, unsigned long long, unsigned int)
Line
Count
Source
161
4
static void checkUInt(uint8_t *Loc, uint64_t V, RelType Type) {
162
4
  if (!llvm::isUInt<N>(V))
163
0
    reportRangeError(Loc, Type, Twine(V), 0, llvm::maxUIntN(N));
164
4
}
X86.cpp:void lld::elf::checkUInt<16u>(unsigned char*, unsigned long long, unsigned int)
Line
Count
Source
161
3
static void checkUInt(uint8_t *Loc, uint64_t V, RelType Type) {
162
3
  if (!llvm::isUInt<N>(V))
163
0
    reportRangeError(Loc, Type, Twine(V), 0, llvm::maxUIntN(N));
164
3
}
X86_64.cpp:void lld::elf::checkUInt<8u>(unsigned char*, unsigned long long, unsigned int)
Line
Count
Source
161
2
static void checkUInt(uint8_t *Loc, uint64_t V, RelType Type) {
162
2
  if (!llvm::isUInt<N>(V))
163
1
    reportRangeError(Loc, Type, Twine(V), 0, llvm::maxUIntN(N));
164
2
}
X86_64.cpp:void lld::elf::checkUInt<16u>(unsigned char*, unsigned long long, unsigned int)
Line
Count
Source
161
2
static void checkUInt(uint8_t *Loc, uint64_t V, RelType Type) {
162
2
  if (!llvm::isUInt<N>(V))
163
1
    reportRangeError(Loc, Type, Twine(V), 0, llvm::maxUIntN(N));
164
2
}
X86_64.cpp:void lld::elf::checkUInt<32u>(unsigned char*, unsigned long long, unsigned int)
Line
Count
Source
161
49
static void checkUInt(uint8_t *Loc, uint64_t V, RelType Type) {
162
49
  if (!llvm::isUInt<N>(V))
163
1
    reportRangeError(Loc, Type, Twine(V), 0, llvm::maxUIntN(N));
164
49
}
165
166
template <unsigned N>
167
13
static void checkIntUInt(uint8_t *Loc, uint64_t V, RelType Type) {
168
13
  if (!llvm::isInt<N>(V) && 
!llvm::isUInt<N>(V)7
)
169
3
    // For the error message we should cast V to a signed integer so that error
170
3
    // messages show a small negative value rather than an extremely large one
171
3
    reportRangeError(Loc, Type, Twine((int64_t)V), llvm::minIntN(N),
172
3
                     llvm::maxUIntN(N));
173
13
}
AArch64.cpp:void lld::elf::checkIntUInt<16u>(unsigned char*, unsigned long long, unsigned int)
Line
Count
Source
167
6
static void checkIntUInt(uint8_t *Loc, uint64_t V, RelType Type) {
168
6
  if (!llvm::isInt<N>(V) && 
!llvm::isUInt<N>(V)3
)
169
1
    // For the error message we should cast V to a signed integer so that error
170
1
    // messages show a small negative value rather than an extremely large one
171
1
    reportRangeError(Loc, Type, Twine((int64_t)V), llvm::minIntN(N),
172
1
                     llvm::maxUIntN(N));
173
6
}
AArch64.cpp:void lld::elf::checkIntUInt<32u>(unsigned char*, unsigned long long, unsigned int)
Line
Count
Source
167
7
static void checkIntUInt(uint8_t *Loc, uint64_t V, RelType Type) {
168
7
  if (!llvm::isInt<N>(V) && 
!llvm::isUInt<N>(V)4
)
169
2
    // For the error message we should cast V to a signed integer so that error
170
2
    // messages show a small negative value rather than an extremely large one
171
2
    reportRangeError(Loc, Type, Twine((int64_t)V), llvm::minIntN(N),
172
2
                     llvm::maxUIntN(N));
173
7
}
174
175
template <unsigned N>
176
69
static void checkAlignment(uint8_t *Loc, uint64_t V, RelType Type) {
177
69
  if ((V & (N - 1)) != 0)
178
5
    error(getErrorLocation(Loc) + "improper alignment for relocation " +
179
5
          lld::toString(Type) + ": 0x" + llvm::utohexstr(V) +
180
5
          " is not aligned to " + Twine(N) + " bytes");
181
69
}
AArch64.cpp:void lld::elf::checkAlignment<4u>(unsigned char*, unsigned long long, unsigned int)
Line
Count
Source
176
11
static void checkAlignment(uint8_t *Loc, uint64_t V, RelType Type) {
177
11
  if ((V & (N - 1)) != 0)
178
2
    error(getErrorLocation(Loc) + "improper alignment for relocation " +
179
2
          lld::toString(Type) + ": 0x" + llvm::utohexstr(V) +
180
2
          " is not aligned to " + Twine(N) + " bytes");
181
11
}
AArch64.cpp:void lld::elf::checkAlignment<8u>(unsigned char*, unsigned long long, unsigned int)
Line
Count
Source
176
46
static void checkAlignment(uint8_t *Loc, uint64_t V, RelType Type) {
177
46
  if ((V & (N - 1)) != 0)
178
1
    error(getErrorLocation(Loc) + "improper alignment for relocation " +
179
1
          lld::toString(Type) + ": 0x" + llvm::utohexstr(V) +
180
1
          " is not aligned to " + Twine(N) + " bytes");
181
46
}
AArch64.cpp:void lld::elf::checkAlignment<2u>(unsigned char*, unsigned long long, unsigned int)
Line
Count
Source
176
5
static void checkAlignment(uint8_t *Loc, uint64_t V, RelType Type) {
177
5
  if ((V & (N - 1)) != 0)
178
1
    error(getErrorLocation(Loc) + "improper alignment for relocation " +
179
1
          lld::toString(Type) + ": 0x" + llvm::utohexstr(V) +
180
1
          " is not aligned to " + Twine(N) + " bytes");
181
5
}
AArch64.cpp:void lld::elf::checkAlignment<16u>(unsigned char*, unsigned long long, unsigned int)
Line
Count
Source
176
3
static void checkAlignment(uint8_t *Loc, uint64_t V, RelType Type) {
177
3
  if ((V & (N - 1)) != 0)
178
1
    error(getErrorLocation(Loc) + "improper alignment for relocation " +
179
1
          lld::toString(Type) + ": 0x" + llvm::utohexstr(V) +
180
1
          " is not aligned to " + Twine(N) + " bytes");
181
3
}
Mips.cpp:void lld::elf::checkAlignment<4u>(unsigned char*, unsigned long long, unsigned int)
Line
Count
Source
176
4
static void checkAlignment(uint8_t *Loc, uint64_t V, RelType Type) {
177
4
  if ((V & (N - 1)) != 0)
178
0
    error(getErrorLocation(Loc) + "improper alignment for relocation " +
179
0
          lld::toString(Type) + ": 0x" + llvm::utohexstr(V) +
180
0
          " is not aligned to " + Twine(N) + " bytes");
181
4
}
Unexecuted instantiation: PPC64.cpp:void lld::elf::checkAlignment<4u>(unsigned char*, unsigned long long, unsigned int)
182
} // namespace elf
183
} // namespace lld
184
185
#endif