comparison lld/ELF/Target.h @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 0572611fdcc8
children c4bab56944e8
comparison
equal deleted inserted replaced
173:0572611fdcc8 207:2e18cbf3894f
120 RelType symbolicRel; 120 RelType symbolicRel;
121 RelType tlsDescRel; 121 RelType tlsDescRel;
122 RelType tlsGotRel; 122 RelType tlsGotRel;
123 RelType tlsModuleIndexRel; 123 RelType tlsModuleIndexRel;
124 RelType tlsOffsetRel; 124 RelType tlsOffsetRel;
125 unsigned gotEntrySize = config->wordsize;
125 unsigned pltEntrySize; 126 unsigned pltEntrySize;
126 unsigned pltHeaderSize; 127 unsigned pltHeaderSize;
127 unsigned ipltEntrySize; 128 unsigned ipltEntrySize;
128 129
129 // At least on x86_64 positions 1 and 2 are used by the first plt entry 130 // At least on x86_64 positions 1 and 2 are used by the first plt entry
146 // If a target needs to rewrite calls to __morestack to instead call 147 // If a target needs to rewrite calls to __morestack to instead call
147 // __morestack_non_split when a split-stack enabled caller calls a 148 // __morestack_non_split when a split-stack enabled caller calls a
148 // non-split-stack callee this will return true. Otherwise returns false. 149 // non-split-stack callee this will return true. Otherwise returns false.
149 bool needsMoreStackNonSplit = true; 150 bool needsMoreStackNonSplit = true;
150 151
151 virtual RelExpr adjustRelaxExpr(RelType type, const uint8_t *data, 152 virtual RelExpr adjustTlsExpr(RelType type, RelExpr expr) const;
152 RelExpr expr) const; 153 virtual RelExpr adjustGotPcExpr(RelType type, int64_t addend,
154 const uint8_t *loc) const;
153 virtual void relaxGot(uint8_t *loc, const Relocation &rel, 155 virtual void relaxGot(uint8_t *loc, const Relocation &rel,
154 uint64_t val) const; 156 uint64_t val) const;
155 virtual void relaxTlsGdToIe(uint8_t *loc, const Relocation &rel, 157 virtual void relaxTlsGdToIe(uint8_t *loc, const Relocation &rel,
156 uint64_t val) const; 158 uint64_t val) const;
157 virtual void relaxTlsGdToLe(uint8_t *loc, const Relocation &rel, 159 virtual void relaxTlsGdToLe(uint8_t *loc, const Relocation &rel,
211 213
212 // Returns true if a relocation is a small code model relocation that accesses 214 // Returns true if a relocation is a small code model relocation that accesses
213 // the .toc section. 215 // the .toc section.
214 bool isPPC64SmallCodeModelTocReloc(RelType type); 216 bool isPPC64SmallCodeModelTocReloc(RelType type);
215 217
218 // Write a prefixed instruction, which is a 4-byte prefix followed by a 4-byte
219 // instruction (regardless of endianness). Therefore, the prefix is always in
220 // lower memory than the instruction.
221 void writePrefixedInstruction(uint8_t *loc, uint64_t insn);
222
223 void addPPC64SaveRestore();
216 uint64_t getPPC64TocBase(); 224 uint64_t getPPC64TocBase();
217 uint64_t getAArch64Page(uint64_t expr); 225 uint64_t getAArch64Page(uint64_t expr);
218 226
219 extern const TargetInfo *target; 227 extern const TargetInfo *target;
220 TargetInfo *getTarget(); 228 TargetInfo *getTarget();
221 229
222 template <class ELFT> bool isMipsPIC(const Defined *sym); 230 template <class ELFT> bool isMipsPIC(const Defined *sym);
223 231
224 void reportRangeError(uint8_t *loc, const Relocation &rel, const Twine &v, 232 void reportRangeError(uint8_t *loc, const Relocation &rel, const Twine &v,
225 int64_t min, uint64_t max); 233 int64_t min, uint64_t max);
234 void reportRangeError(uint8_t *loc, int64_t v, int n, const Symbol &sym,
235 const Twine &msg);
226 236
227 // Make sure that V can be represented as an N bit signed integer. 237 // Make sure that V can be represented as an N bit signed integer.
228 inline void checkInt(uint8_t *loc, int64_t v, int n, const Relocation &rel) { 238 inline void checkInt(uint8_t *loc, int64_t v, int n, const Relocation &rel) {
229 if (v != llvm::SignExtend64(v, n)) 239 if (v != llvm::SignExtend64(v, n))
230 reportRangeError(loc, rel, Twine(v), llvm::minIntN(n), llvm::maxIntN(n)); 240 reportRangeError(loc, rel, Twine(v), llvm::minIntN(n), llvm::maxIntN(n));