LLVM  15.0.0git
ELF_riscv.cpp
Go to the documentation of this file.
1 //===------- ELF_riscv.cpp -JIT linker implementation for ELF/riscv -------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // ELF/riscv jit-link implementation.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "ELFLinkGraphBuilder.h"
15 #include "JITLinkGeneric.h"
17 #include "llvm/BinaryFormat/ELF.h"
20 #include "llvm/Object/ELF.h"
22 #include "llvm/Support/Endian.h"
23 
24 #define DEBUG_TYPE "jitlink"
25 using namespace llvm;
26 using namespace llvm::jitlink;
27 using namespace llvm::jitlink::riscv;
28 
29 namespace {
30 
31 class PerGraphGOTAndPLTStubsBuilder_ELF_riscv
33  PerGraphGOTAndPLTStubsBuilder_ELF_riscv> {
34 public:
35  static constexpr size_t StubEntrySize = 16;
36  static const uint8_t NullGOTEntryContent[8];
37  static const uint8_t RV64StubContent[StubEntrySize];
38  static const uint8_t RV32StubContent[StubEntrySize];
39 
41  PerGraphGOTAndPLTStubsBuilder_ELF_riscv>::PerGraphGOTAndPLTStubsBuilder;
42 
43  bool isRV64() const { return G.getPointerSize() == 8; }
44 
45  bool isGOTEdgeToFix(Edge &E) const { return E.getKind() == R_RISCV_GOT_HI20; }
46 
47  Symbol &createGOTEntry(Symbol &Target) {
48  Block &GOTBlock =
49  G.createContentBlock(getGOTSection(), getGOTEntryBlockContent(),
50  orc::ExecutorAddr(), G.getPointerSize(), 0);
51  GOTBlock.addEdge(isRV64() ? R_RISCV_64 : R_RISCV_32, 0, Target, 0);
52  return G.addAnonymousSymbol(GOTBlock, 0, G.getPointerSize(), false, false);
53  }
54 
55  Symbol &createPLTStub(Symbol &Target) {
56  Block &StubContentBlock = G.createContentBlock(
57  getStubsSection(), getStubBlockContent(), orc::ExecutorAddr(), 4, 0);
58  auto &GOTEntrySymbol = getGOTEntry(Target);
59  StubContentBlock.addEdge(R_RISCV_CALL, 0, GOTEntrySymbol, 0);
60  return G.addAnonymousSymbol(StubContentBlock, 0, StubEntrySize, true,
61  false);
62  }
63 
64  void fixGOTEdge(Edge &E, Symbol &GOTEntry) {
65  // Replace the relocation pair (R_RISCV_GOT_HI20, R_RISCV_PCREL_LO12)
66  // with (R_RISCV_PCREL_HI20, R_RISCV_PCREL_LO12)
67  // Therefore, here just change the R_RISCV_GOT_HI20 to R_RISCV_PCREL_HI20
68  E.setKind(R_RISCV_PCREL_HI20);
69  E.setTarget(GOTEntry);
70  }
71 
72  void fixPLTEdge(Edge &E, Symbol &PLTStubs) {
73  assert(E.getKind() == R_RISCV_CALL_PLT && "Not a R_RISCV_CALL_PLT edge?");
74  E.setKind(R_RISCV_CALL);
75  E.setTarget(PLTStubs);
76  }
77 
78  bool isExternalBranchEdge(Edge &E) const {
79  return E.getKind() == R_RISCV_CALL_PLT;
80  }
81 
82 private:
83  Section &getGOTSection() const {
84  if (!GOTSection)
85  GOTSection = &G.createSection("$__GOT", MemProt::Read);
86  return *GOTSection;
87  }
88 
89  Section &getStubsSection() const {
90  if (!StubsSection)
91  StubsSection =
92  &G.createSection("$__STUBS", MemProt::Read | MemProt::Exec);
93  return *StubsSection;
94  }
95 
96  ArrayRef<char> getGOTEntryBlockContent() {
97  return {reinterpret_cast<const char *>(NullGOTEntryContent),
98  G.getPointerSize()};
99  }
100 
101  ArrayRef<char> getStubBlockContent() {
102  auto StubContent = isRV64() ? RV64StubContent : RV32StubContent;
103  return {reinterpret_cast<const char *>(StubContent), StubEntrySize};
104  }
105 
106  mutable Section *GOTSection = nullptr;
107  mutable Section *StubsSection = nullptr;
108 };
109 
111  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
112 
113 const uint8_t
114  PerGraphGOTAndPLTStubsBuilder_ELF_riscv::RV64StubContent[StubEntrySize] = {
115  0x17, 0x0e, 0x00, 0x00, // auipc t3, literal
116  0x03, 0x3e, 0x0e, 0x00, // ld t3, literal(t3)
117  0x67, 0x00, 0x0e, 0x00, // jr t3
118  0x13, 0x00, 0x00, 0x00}; // nop
119 
120 const uint8_t
121  PerGraphGOTAndPLTStubsBuilder_ELF_riscv::RV32StubContent[StubEntrySize] = {
122  0x17, 0x0e, 0x00, 0x00, // auipc t3, literal
123  0x03, 0x2e, 0x0e, 0x00, // lw t3, literal(t3)
124  0x67, 0x00, 0x0e, 0x00, // jr t3
125  0x13, 0x00, 0x00, 0x00}; // nop
126 } // namespace
127 namespace llvm {
128 namespace jitlink {
129 
131  using namespace riscv;
132  assert((E.getKind() == R_RISCV_PCREL_LO12_I ||
133  E.getKind() == R_RISCV_PCREL_LO12_S) &&
134  "Can only have high relocation for R_RISCV_PCREL_LO12_I or "
135  "R_RISCV_PCREL_LO12_S");
136 
137  const Symbol &Sym = E.getTarget();
138  const Block &B = Sym.getBlock();
139  orc::ExecutorAddrDiff Offset = Sym.getOffset();
140 
141  struct Comp {
142  bool operator()(const Edge &Lhs, orc::ExecutorAddrDiff Offset) {
143  return Lhs.getOffset() < Offset;
144  }
145  bool operator()(orc::ExecutorAddrDiff Offset, const Edge &Rhs) {
146  return Offset < Rhs.getOffset();
147  }
148  };
149 
150  auto Bound =
151  std::equal_range(B.edges().begin(), B.edges().end(), Offset, Comp{});
152 
153  for (auto It = Bound.first; It != Bound.second; ++It) {
154  if (It->getKind() == R_RISCV_PCREL_HI20)
155  return *It;
156  }
157 
158  return make_error<JITLinkError>(
159  "No HI20 PCREL relocation type be found for LO12 PCREL relocation type");
160 }
161 
162 static uint32_t extractBits(uint32_t Num, unsigned Low, unsigned Size) {
163  return (Num & (((1ULL << Size) - 1) << Low)) >> Low;
164 }
165 
166 static inline bool isAlignmentCorrect(uint64_t Value, int N) {
167  return (Value & (N - 1)) ? false : true;
168 }
169 
170 // Requires 0 < N <= 64.
171 static inline bool isInRangeForImm(int64_t Value, int N) {
172  return Value == llvm::SignExtend64(Value, N);
173 }
174 
175 class ELFJITLinker_riscv : public JITLinker<ELFJITLinker_riscv> {
177 
178 public:
179  ELFJITLinker_riscv(std::unique_ptr<JITLinkContext> Ctx,
180  std::unique_ptr<LinkGraph> G, PassConfiguration PassConfig)
181  : JITLinker(std::move(Ctx), std::move(G), std::move(PassConfig)) {}
182 
183 private:
184  Error applyFixup(LinkGraph &G, Block &B, const Edge &E) const {
185  using namespace riscv;
186  using namespace llvm::support;
187 
188  char *BlockWorkingMem = B.getAlreadyMutableContent().data();
189  char *FixupPtr = BlockWorkingMem + E.getOffset();
190  orc::ExecutorAddr FixupAddress = B.getAddress() + E.getOffset();
191  switch (E.getKind()) {
192  case R_RISCV_32: {
193  int64_t Value = (E.getTarget().getAddress() + E.getAddend()).getValue();
194  *(little32_t *)FixupPtr = static_cast<uint32_t>(Value);
195  break;
196  }
197  case R_RISCV_64: {
198  int64_t Value = (E.getTarget().getAddress() + E.getAddend()).getValue();
199  *(little64_t *)FixupPtr = static_cast<uint64_t>(Value);
200  break;
201  }
202  case R_RISCV_BRANCH: {
203  int64_t Value = E.getTarget().getAddress() + E.getAddend() - FixupAddress;
204  if (LLVM_UNLIKELY(!isInRangeForImm(Value >> 1, 12)))
205  return makeTargetOutOfRangeError(G, B, E);
207  return makeAlignmentError(FixupAddress, Value, 2, E);
208  uint32_t Imm31_25 =
209  extractBits(Value, 5, 6) << 25 | extractBits(Value, 12, 1) << 31;
210  uint32_t Imm11_7 =
211  extractBits(Value, 1, 4) << 8 | extractBits(Value, 11, 1) << 7;
212  uint32_t RawInstr = *(little32_t *)FixupPtr;
213  *(little32_t *)FixupPtr = (RawInstr & 0x1FFF07F) | Imm31_25 | Imm11_7;
214  break;
215  }
216  case R_RISCV_JAL: {
217  int64_t Value = E.getTarget().getAddress() + E.getAddend() - FixupAddress;
218  if (LLVM_UNLIKELY(!isInRangeForImm(Value >> 1, 20)))
219  return makeTargetOutOfRangeError(G, B, E);
221  return makeAlignmentError(FixupAddress, Value, 2, E);
222  uint32_t Imm20 = extractBits(Value, 20, 1) << 31;
223  uint32_t Imm10_1 = extractBits(Value, 1, 10) << 21;
224  uint32_t Imm11 = extractBits(Value, 11, 1) << 20;
225  uint32_t Imm19_12 = extractBits(Value, 12, 8) << 12;
226  uint32_t RawInstr = *(little32_t *)FixupPtr;
227  *(little32_t *)FixupPtr = RawInstr | Imm20 | Imm10_1 | Imm11 | Imm19_12;
228  break;
229  }
230  case R_RISCV_HI20: {
231  int64_t Value = (E.getTarget().getAddress() + E.getAddend()).getValue();
232  int64_t Hi = Value + 0x800;
233  if (LLVM_UNLIKELY(!isInRangeForImm(Hi, 32)))
234  return makeTargetOutOfRangeError(G, B, E);
235  uint32_t RawInstr = *(little32_t *)FixupPtr;
236  *(little32_t *)FixupPtr =
237  (RawInstr & 0xFFF) | (static_cast<uint32_t>(Hi & 0xFFFFF000));
238  break;
239  }
240  case R_RISCV_LO12_I: {
241  // FIXME: We assume that R_RISCV_HI20 is present in object code and pairs
242  // with current relocation R_RISCV_LO12_I. So here may need a check.
243  int64_t Value = (E.getTarget().getAddress() + E.getAddend()).getValue();
244  int32_t Lo = Value & 0xFFF;
245  uint32_t RawInstr = *(little32_t *)FixupPtr;
246  *(little32_t *)FixupPtr =
247  (RawInstr & 0xFFFFF) | (static_cast<uint32_t>(Lo & 0xFFF) << 20);
248  break;
249  }
250  case R_RISCV_CALL: {
251  int64_t Value = E.getTarget().getAddress() + E.getAddend() - FixupAddress;
252  int64_t Hi = Value + 0x800;
253  if (LLVM_UNLIKELY(!isInRangeForImm(Hi, 32)))
254  return makeTargetOutOfRangeError(G, B, E);
255  int32_t Lo = Value & 0xFFF;
256  uint32_t RawInstrAuipc = *(little32_t *)FixupPtr;
257  uint32_t RawInstrJalr = *(little32_t *)(FixupPtr + 4);
258  *(little32_t *)FixupPtr =
259  RawInstrAuipc | (static_cast<uint32_t>(Hi & 0xFFFFF000));
260  *(little32_t *)(FixupPtr + 4) =
261  RawInstrJalr | (static_cast<uint32_t>(Lo) << 20);
262  break;
263  }
264  case R_RISCV_PCREL_HI20: {
265  int64_t Value = E.getTarget().getAddress() + E.getAddend() - FixupAddress;
266  int64_t Hi = Value + 0x800;
267  if (LLVM_UNLIKELY(!isInRangeForImm(Hi, 32)))
268  return makeTargetOutOfRangeError(G, B, E);
269  uint32_t RawInstr = *(little32_t *)FixupPtr;
270  *(little32_t *)FixupPtr =
271  (RawInstr & 0xFFF) | (static_cast<uint32_t>(Hi & 0xFFFFF000));
272  break;
273  }
274  case R_RISCV_PCREL_LO12_I: {
275  // FIXME: We assume that R_RISCV_PCREL_HI20 is present in object code and
276  // pairs with current relocation R_RISCV_PCREL_LO12_I. So here may need a
277  // check.
278  auto RelHI20 = getRISCVPCRelHi20(E);
279  if (!RelHI20)
280  return RelHI20.takeError();
281  int64_t Value = RelHI20->getTarget().getAddress() +
282  RelHI20->getAddend() - E.getTarget().getAddress();
283  int64_t Lo = Value & 0xFFF;
284  uint32_t RawInstr = *(little32_t *)FixupPtr;
285  *(little32_t *)FixupPtr =
286  (RawInstr & 0xFFFFF) | (static_cast<uint32_t>(Lo & 0xFFF) << 20);
287  break;
288  }
289  case R_RISCV_PCREL_LO12_S: {
290  // FIXME: We assume that R_RISCV_PCREL_HI20 is present in object code and
291  // pairs with current relocation R_RISCV_PCREL_LO12_S. So here may need a
292  // check.
293  auto RelHI20 = getRISCVPCRelHi20(E);
294  int64_t Value = RelHI20->getTarget().getAddress() +
295  RelHI20->getAddend() - E.getTarget().getAddress();
296  int64_t Lo = Value & 0xFFF;
297  uint32_t Imm31_25 = extractBits(Lo, 5, 7) << 25;
298  uint32_t Imm11_7 = extractBits(Lo, 0, 5) << 7;
299  uint32_t RawInstr = *(little32_t *)FixupPtr;
300 
301  *(little32_t *)FixupPtr = (RawInstr & 0x1FFF07F) | Imm31_25 | Imm11_7;
302  break;
303  }
304  case R_RISCV_ADD64: {
305  int64_t Value = (E.getTarget().getAddress() +
306  support::endian::read64le(reinterpret_cast<const void *>(
307  FixupAddress.getValue())) +
308  E.getAddend())
309  .getValue();
310  *(little64_t *)FixupPtr = static_cast<uint64_t>(Value);
311  break;
312  }
313  case R_RISCV_ADD32: {
314  int64_t Value = (E.getTarget().getAddress() +
315  support::endian::read32le(reinterpret_cast<const void *>(
316  FixupAddress.getValue())) +
317  E.getAddend())
318  .getValue();
319  *(little32_t *)FixupPtr = static_cast<uint32_t>(Value);
320  break;
321  }
322  case R_RISCV_ADD16: {
323  int64_t Value = (E.getTarget().getAddress() +
324  support::endian::read16le(reinterpret_cast<const void *>(
325  FixupAddress.getValue())) +
326  E.getAddend())
327  .getValue();
328  *(little16_t *)FixupPtr = static_cast<uint32_t>(Value);
329  break;
330  }
331  case R_RISCV_ADD8: {
332  int64_t Value =
333  (E.getTarget().getAddress() +
334  *(reinterpret_cast<const uint8_t *>(FixupAddress.getValue())) +
335  E.getAddend())
336  .getValue();
337  *FixupPtr = static_cast<uint8_t>(Value);
338  break;
339  }
340  case R_RISCV_SUB64: {
341  int64_t Value = support::endian::read64le(reinterpret_cast<const void *>(
342  FixupAddress.getValue())) -
343  E.getTarget().getAddress().getValue() - E.getAddend();
344  *(little64_t *)FixupPtr = static_cast<uint64_t>(Value);
345  break;
346  }
347  case R_RISCV_SUB32: {
348  int64_t Value = support::endian::read32le(reinterpret_cast<const void *>(
349  FixupAddress.getValue())) -
350  E.getTarget().getAddress().getValue() - E.getAddend();
351  *(little32_t *)FixupPtr = static_cast<uint32_t>(Value);
352  break;
353  }
354  case R_RISCV_SUB16: {
355  int64_t Value = support::endian::read16le(reinterpret_cast<const void *>(
356  FixupAddress.getValue())) -
357  E.getTarget().getAddress().getValue() - E.getAddend();
358  *(little16_t *)FixupPtr = static_cast<uint32_t>(Value);
359  break;
360  }
361  case R_RISCV_SUB8: {
362  int64_t Value =
363  *(reinterpret_cast<const uint8_t *>(FixupAddress.getValue())) -
364  E.getTarget().getAddress().getValue() - E.getAddend();
365  *FixupPtr = static_cast<uint8_t>(Value);
366  break;
367  }
368  case R_RISCV_SUB6: {
369  int64_t Value =
370  *(reinterpret_cast<const uint8_t *>(FixupAddress.getValue())) & 0x3f;
371  Value -= E.getTarget().getAddress().getValue() - E.getAddend();
372  *FixupPtr = (*FixupPtr & 0xc0) | (static_cast<uint8_t>(Value) & 0x3f);
373  break;
374  }
375  case R_RISCV_SET6: {
376  int64_t Value = (E.getTarget().getAddress() + E.getAddend()).getValue();
377  uint32_t RawData = *(little32_t *)FixupPtr;
378  int64_t Word6 = Value & 0x3f;
379  *(little32_t *)FixupPtr = (RawData & 0xffffffc0) | Word6;
380  break;
381  }
382  case R_RISCV_SET8: {
383  int64_t Value = (E.getTarget().getAddress() + E.getAddend()).getValue();
384  uint32_t RawData = *(little32_t *)FixupPtr;
385  int64_t Word8 = Value & 0xff;
386  *(little32_t *)FixupPtr = (RawData & 0xffffff00) | Word8;
387  break;
388  }
389  case R_RISCV_SET16: {
390  int64_t Value = (E.getTarget().getAddress() + E.getAddend()).getValue();
391  uint32_t RawData = *(little32_t *)FixupPtr;
392  int64_t Word16 = Value & 0xffff;
393  *(little32_t *)FixupPtr = (RawData & 0xffff0000) | Word16;
394  break;
395  }
396  case R_RISCV_SET32: {
397  int64_t Value = (E.getTarget().getAddress() + E.getAddend()).getValue();
398  int64_t Word32 = Value & 0xffffffff;
399  *(little32_t *)FixupPtr = Word32;
400  break;
401  }
402  case R_RISCV_32_PCREL: {
403  int64_t Value = E.getTarget().getAddress() + E.getAddend() - FixupAddress;
404  int64_t Word32 = Value & 0xffffffff;
405  *(little32_t *)FixupPtr = Word32;
406  break;
407  }
408  }
409  return Error::success();
410  }
411 };
412 
413 template <typename ELFT>
415 private:
417  getRelocationKind(const uint32_t Type) {
418  using namespace riscv;
419  switch (Type) {
420  case ELF::R_RISCV_32:
422  case ELF::R_RISCV_64:
424  case ELF::R_RISCV_BRANCH:
426  case ELF::R_RISCV_JAL:
428  case ELF::R_RISCV_HI20:
430  case ELF::R_RISCV_LO12_I:
432  case ELF::R_RISCV_CALL:
444  case ELF::R_RISCV_ADD64:
446  case ELF::R_RISCV_ADD32:
448  case ELF::R_RISCV_ADD16:
450  case ELF::R_RISCV_ADD8:
452  case ELF::R_RISCV_SUB64:
454  case ELF::R_RISCV_SUB32:
456  case ELF::R_RISCV_SUB16:
458  case ELF::R_RISCV_SUB8:
460  case ELF::R_RISCV_SUB6:
462  case ELF::R_RISCV_SET6:
464  case ELF::R_RISCV_SET8:
466  case ELF::R_RISCV_SET16:
468  case ELF::R_RISCV_SET32:
472  }
473 
474  return make_error<JITLinkError>(
475  "Unsupported riscv relocation:" + formatv("{0:d}: ", Type) +
477  }
478 
479  Error addRelocations() override {
480  LLVM_DEBUG(dbgs() << "Processing relocations:\n");
481 
483  using Self = ELFLinkGraphBuilder_riscv<ELFT>;
484  for (const auto &RelSect : Base::Sections)
485  if (Error Err = Base::forEachRelocation(RelSect, this,
486  &Self::addSingleRelocation))
487  return Err;
488 
489  return Error::success();
490  }
491 
492  Error addSingleRelocation(const typename ELFT::Rela &Rel,
493  const typename ELFT::Shdr &FixupSect,
494  Block &BlockToFix) {
496 
497  uint32_t SymbolIndex = Rel.getSymbol(false);
498  auto ObjSymbol = Base::Obj.getRelocationSymbol(Rel, Base::SymTabSec);
499  if (!ObjSymbol)
500  return ObjSymbol.takeError();
501 
502  Symbol *GraphSymbol = Base::getGraphSymbol(SymbolIndex);
503  if (!GraphSymbol)
504  return make_error<StringError>(
505  formatv("Could not find symbol at given index, did you add it to "
506  "JITSymbolTable? index: {0}, shndx: {1} Size of table: {2}",
507  SymbolIndex, (*ObjSymbol)->st_shndx,
508  Base::GraphSymbols.size()),
510 
511  uint32_t Type = Rel.getType(false);
512  Expected<riscv::EdgeKind_riscv> Kind = getRelocationKind(Type);
513  if (!Kind)
514  return Kind.takeError();
515 
516  int64_t Addend = Rel.r_addend;
517  auto FixupAddress = orc::ExecutorAddr(FixupSect.sh_addr) + Rel.r_offset;
518  Edge::OffsetT Offset = FixupAddress - BlockToFix.getAddress();
519  Edge GE(*Kind, Offset, *GraphSymbol, Addend);
520  LLVM_DEBUG({
521  dbgs() << " ";
522  printEdge(dbgs(), BlockToFix, GE, riscv::getEdgeKindName(*Kind));
523  dbgs() << "\n";
524  });
525 
526  BlockToFix.addEdge(std::move(GE));
527  return Error::success();
528  }
529 
530 public:
532  const object::ELFFile<ELFT> &Obj, const Triple T)
533  : ELFLinkGraphBuilder<ELFT>(Obj, std::move(T), FileName,
534  riscv::getEdgeKindName) {}
535 };
536 
539  LLVM_DEBUG({
540  dbgs() << "Building jitlink graph for new input "
541  << ObjectBuffer.getBufferIdentifier() << "...\n";
542  });
543 
544  auto ELFObj = object::ObjectFile::createELFObjectFile(ObjectBuffer);
545  if (!ELFObj)
546  return ELFObj.takeError();
547 
548  if ((*ELFObj)->getArch() == Triple::riscv64) {
549  auto &ELFObjFile = cast<object::ELFObjectFile<object::ELF64LE>>(**ELFObj);
551  (*ELFObj)->getFileName(), ELFObjFile.getELFFile(),
552  (*ELFObj)->makeTriple())
553  .buildGraph();
554  } else {
555  assert((*ELFObj)->getArch() == Triple::riscv32 &&
556  "Invalid triple for RISCV ELF object file");
557  auto &ELFObjFile = cast<object::ELFObjectFile<object::ELF32LE>>(**ELFObj);
559  (*ELFObj)->getFileName(), ELFObjFile.getELFFile(),
560  (*ELFObj)->makeTriple())
561  .buildGraph();
562  }
563 }
564 
565 void link_ELF_riscv(std::unique_ptr<LinkGraph> G,
566  std::unique_ptr<JITLinkContext> Ctx) {
567  PassConfiguration Config;
568  const Triple &TT = G->getTargetTriple();
569  if (Ctx->shouldAddDefaultTargetPasses(TT)) {
570  if (auto MarkLive = Ctx->getMarkLivePass(TT))
571  Config.PrePrunePasses.push_back(std::move(MarkLive));
572  else
573  Config.PrePrunePasses.push_back(markAllSymbolsLive);
574  Config.PostPrunePasses.push_back(
575  PerGraphGOTAndPLTStubsBuilder_ELF_riscv::asPass);
576  }
577  if (auto Err = Ctx->modifyPassConfig(*G, Config))
578  return Ctx->notifyFailed(std::move(Err));
579 
581 }
582 
583 } // namespace jitlink
584 } // namespace llvm
llvm::orc::ExecutorAddr
Represents an address in the executor process.
Definition: ExecutorAddress.h:30
llvm::Triple::riscv64
@ riscv64
Definition: Triple.h:76
llvm::Hexagon::Word16
@ Word16
Definition: HexagonFixupKinds.h:124
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::support::detail::packed_endian_specific_integral
Definition: Endian.h:206
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:145
llvm::support::endian::read16le
uint16_t read16le(const void *P)
Definition: Endian.h:380
llvm::MipsISD::Lo
@ Lo
Definition: MipsISelLowering.h:79
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:329
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
llvm::orc::ExecutorAddr::getValue
uint64_t getValue() const
Definition: ExecutorAddress.h:62
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
llvm::Hexagon::Word32
@ Word32
Definition: HexagonFixupKinds.h:125
llvm::MemoryBufferRef
Definition: MemoryBufferRef.h:22
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:101
llvm::MipsISD::Hi
@ Hi
Definition: MipsISelLowering.h:75
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
llvm::formatv
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
Definition: FormatVariadic.h:251
ELF.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::ThreadPriority::Low
@ Low
Lower the current thread's priority such that it does not affect foreground tasks significantly.
llvm::object::ObjectFile::createELFObjectFile
static Expected< std::unique_ptr< ObjectFile > > createELFObjectFile(MemoryBufferRef Object, bool InitContent=true)
Definition: ELFObjectFile.cpp:70
llvm::ELF::EM_RISCV
@ EM_RISCV
Definition: ELF.h:317
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:200
llvm::object::getELFRelocationTypeName
StringRef getELFRelocationTypeName(uint32_t Machine, uint32_t Type)
Definition: ELF.cpp:22
uint64_t
ELF.h
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1675
riscv.h
llvm::AArch64CC::GE
@ GE
Definition: AArch64BaseInfo.h:265
llvm::ArrayRef< char >
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
uint32_t
ELF_riscv.h
llvm::SignExtend64
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
Definition: MathExtras.h:811
ELFObjectFile.h
PerGraphGOTAndPLTStubsBuilder.h
std
Definition: BitVector.h:851
llvm::inconvertibleErrorCode
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition: Error.cpp:77
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::Triple::riscv32
@ riscv32
Definition: Triple.h:75
llvm::support
Definition: Endian.h:25
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
false
Function Alias Analysis false
Definition: AliasAnalysis.cpp:848
llvm::support::endian::read64le
uint64_t read64le(const void *P)
Definition: Endian.h:382
llvm::support::endian::read32le
uint32_t read32le(const void *P)
Definition: Endian.h:381
N
#define N
llvm::MemoryBufferRef::getBufferIdentifier
StringRef getBufferIdentifier() const
Definition: MemoryBufferRef.h:33
ELFLinkGraphBuilder.h
LLVM_UNLIKELY
#define LLVM_UNLIKELY(EXPR)
Definition: Compiler.h:220
Endian.h
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::object::ELFFile
Definition: ELF.h:94
JITLinkGeneric.h
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58
Shdr
Elf_Shdr Shdr
Definition: ELFObjHandler.cpp:77
llvm::Hexagon::Word8
@ Word8
Definition: HexagonFixupKinds.h:123