LLVM 18.0.0git
ELFLinkGraphBuilder.h
Go to the documentation of this file.
1//===------- ELFLinkGraphBuilder.h - ELF LinkGraph builder ------*- C++ -*-===//
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// Generic ELF LinkGraph building code.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LIB_EXECUTIONENGINE_JITLINK_ELFLINKGRAPHBUILDER_H
14#define LIB_EXECUTIONENGINE_JITLINK_ELFLINKGRAPHBUILDER_H
15
17#include "llvm/Object/ELF.h"
18#include "llvm/Support/Debug.h"
19#include "llvm/Support/Error.h"
21
22#define DEBUG_TYPE "jitlink"
23
24namespace llvm {
25namespace jitlink {
26
27/// Common link-graph building code shared between all ELFFiles.
29public:
30 ELFLinkGraphBuilderBase(std::unique_ptr<LinkGraph> G) : G(std::move(G)) {}
32
33protected:
35 return llvm::is_contained(DwarfSectionNames, SectionName);
36 }
37
39 if (!CommonSection)
40 CommonSection = &G->createSection(
41 CommonSectionName, orc::MemProt::Read | orc::MemProt::Write);
42 return *CommonSection;
43 }
44
45 std::unique_ptr<LinkGraph> G;
46
47private:
48 static StringRef CommonSectionName;
49 static ArrayRef<const char *> DwarfSectionNames;
50
51 Section *CommonSection = nullptr;
52};
53
54/// LinkGraph building code that's specific to the given ELFT, but common
55/// across all architectures.
56template <typename ELFT>
59
60public:
62 SubtargetFeatures Features, StringRef FileName,
64
65 /// Debug sections are included in the graph by default. Use
66 /// setProcessDebugSections(false) to ignore them if debug info is not
67 /// needed.
69 this->ProcessDebugSections = ProcessDebugSections;
70 return *this;
71 }
72
73 /// Attempt to construct and return the LinkGraph.
75
76 /// Call to derived class to handle relocations. These require
77 /// architecture specific knowledge to map to JITLink edge kinds.
78 virtual Error addRelocations() = 0;
79
80protected:
83
84 bool isRelocatable() const {
85 return Obj.getHeader().e_type == llvm::ELF::ET_REL;
86 }
87
89 assert(!GraphBlocks.count(SecIndex) && "Duplicate section at index");
90 GraphBlocks[SecIndex] = B;
91 }
92
94 return GraphBlocks.lookup(SecIndex);
95 }
96
98 assert(!GraphSymbols.count(SymIndex) && "Duplicate symbol at index");
99 GraphSymbols[SymIndex] = &Sym;
100 }
101
103 return GraphSymbols.lookup(SymIndex);
104 }
105
107 getSymbolLinkageAndScope(const typename ELFT::Sym &Sym, StringRef Name);
108
109 /// Set the target flags on the given Symbol.
110 virtual TargetFlagsType makeTargetFlags(const typename ELFT::Sym &Sym) {
111 return TargetFlagsType{};
112 }
113
114 /// Get the physical offset of the symbol on the target platform.
115 virtual orc::ExecutorAddrDiff getRawOffset(const typename ELFT::Sym &Sym,
116 TargetFlagsType Flags) {
117 return Sym.getValue();
118 }
119
123
124 /// Override in derived classes to suppress certain sections in the link
125 /// graph.
126 virtual bool excludeSection(const typename ELFT::Shdr &Sect) const {
127 return false;
128 }
129
130 /// Traverse all matching ELFT::Rela relocation records in the given section.
131 /// The handler function Func should be callable with this signature:
132 /// Error(const typename ELFT::Rela &,
133 /// const typename ELFT::Shdr &, Section &)
134 ///
135 template <typename RelocHandlerMethod>
136 Error forEachRelaRelocation(const typename ELFT::Shdr &RelSect,
137 RelocHandlerMethod &&Func);
138
139 /// Traverse all matching ELFT::Rel relocation records in the given section.
140 /// The handler function Func should be callable with this signature:
141 /// Error(const typename ELFT::Rel &,
142 /// const typename ELFT::Shdr &, Section &)
143 ///
144 template <typename RelocHandlerMethod>
145 Error forEachRelRelocation(const typename ELFT::Shdr &RelSect,
146 RelocHandlerMethod &&Func);
147
148 /// Traverse all matching rela relocation records in the given section.
149 /// Convenience wrapper to allow passing a member function for the handler.
150 ///
151 template <typename ClassT, typename RelocHandlerMethod>
152 Error forEachRelaRelocation(const typename ELFT::Shdr &RelSect,
153 ClassT *Instance, RelocHandlerMethod &&Method) {
155 RelSect,
156 [Instance, Method](const auto &Rel, const auto &Target, auto &GS) {
157 return (Instance->*Method)(Rel, Target, GS);
158 });
159 }
160
161 /// Traverse all matching rel relocation records in the given section.
162 /// Convenience wrapper to allow passing a member function for the handler.
163 ///
164 template <typename ClassT, typename RelocHandlerMethod>
165 Error forEachRelRelocation(const typename ELFT::Shdr &RelSect,
166 ClassT *Instance, RelocHandlerMethod &&Method) {
168 RelSect,
169 [Instance, Method](const auto &Rel, const auto &Target, auto &GS) {
170 return (Instance->*Method)(Rel, Target, GS);
171 });
172 }
173
174 const ELFFile &Obj;
175
176 typename ELFFile::Elf_Shdr_Range Sections;
177 const typename ELFFile::Elf_Shdr *SymTabSec = nullptr;
180
181 // Maps ELF section indexes to LinkGraph Blocks.
182 // Only SHF_ALLOC sections will have graph blocks.
185 DenseMap<const typename ELFFile::Elf_Shdr *,
188};
189
190template <typename ELFT>
192 const ELFFile &Obj, Triple TT, SubtargetFeatures Features,
193 StringRef FileName, LinkGraph::GetEdgeKindNameFunction GetEdgeKindName)
194 : ELFLinkGraphBuilderBase(std::make_unique<LinkGraph>(
195 FileName.str(), Triple(std::move(TT)), std::move(Features),
196 ELFT::Is64Bits ? 8 : 4, support::endianness(ELFT::TargetEndianness),
197 std::move(GetEdgeKindName))),
198 Obj(Obj) {
200 { dbgs() << "Created ELFLinkGraphBuilder for \"" << FileName << "\""; });
201}
202
203template <typename ELFT>
205 if (!isRelocatable())
206 return make_error<JITLinkError>("Object is not a relocatable ELF file");
207
208 if (auto Err = prepare())
209 return std::move(Err);
210
211 if (auto Err = graphifySections())
212 return std::move(Err);
213
214 if (auto Err = graphifySymbols())
215 return std::move(Err);
216
217 if (auto Err = addRelocations())
218 return std::move(Err);
219
220 return std::move(G);
221}
222
223template <typename ELFT>
226 const typename ELFT::Sym &Sym, StringRef Name) {
229
230 switch (Sym.getBinding()) {
231 case ELF::STB_LOCAL:
232 S = Scope::Local;
233 break;
234 case ELF::STB_GLOBAL:
235 // Nothing to do here.
236 break;
237 case ELF::STB_WEAK:
239 L = Linkage::Weak;
240 break;
241 default:
242 return make_error<StringError>(
243 "Unrecognized symbol binding " +
244 Twine(static_cast<int>(Sym.getBinding())) + " for " + Name,
246 }
247
248 switch (Sym.getVisibility()) {
249 case ELF::STV_DEFAULT:
251 // FIXME: Make STV_DEFAULT symbols pre-emptible? This probably needs
252 // Orc support.
253 // Otherwise nothing to do here.
254 break;
255 case ELF::STV_HIDDEN:
256 // Default scope -> Hidden scope. No effect on local scope.
257 if (S == Scope::Default)
258 S = Scope::Hidden;
259 break;
261 return make_error<StringError>(
262 "Unrecognized symbol visibility " +
263 Twine(static_cast<int>(Sym.getVisibility())) + " for " + Name,
265 }
266
267 return std::make_pair(L, S);
268}
269
270template <typename ELFT> Error ELFLinkGraphBuilder<ELFT>::prepare() {
271 LLVM_DEBUG(dbgs() << " Preparing to build...\n");
272
273 // Get the sections array.
274 if (auto SectionsOrErr = Obj.sections())
275 Sections = *SectionsOrErr;
276 else
277 return SectionsOrErr.takeError();
278
279 // Get the section string table.
280 if (auto SectionStringTabOrErr = Obj.getSectionStringTable(Sections))
281 SectionStringTab = *SectionStringTabOrErr;
282 else
283 return SectionStringTabOrErr.takeError();
284
285 // Get the SHT_SYMTAB section.
286 for (auto &Sec : Sections) {
287 if (Sec.sh_type == ELF::SHT_SYMTAB) {
288 if (!SymTabSec)
289 SymTabSec = &Sec;
290 else
291 return make_error<JITLinkError>("Multiple SHT_SYMTAB sections in " +
292 G->getName());
293 }
294
295 // Extended table.
296 if (Sec.sh_type == ELF::SHT_SYMTAB_SHNDX) {
297 uint32_t SymtabNdx = Sec.sh_link;
298 if (SymtabNdx >= Sections.size())
299 return make_error<JITLinkError>("sh_link is out of bound");
300
301 auto ShndxTable = Obj.getSHNDXTable(Sec);
302 if (!ShndxTable)
303 return ShndxTable.takeError();
304
305 ShndxTables.insert({&Sections[SymtabNdx], *ShndxTable});
306 }
307 }
308
309 return Error::success();
310}
311
313 LLVM_DEBUG(dbgs() << " Creating graph sections...\n");
314
315 // For each section...
316 for (ELFSectionIndex SecIndex = 0; SecIndex != Sections.size(); ++SecIndex) {
317
318 auto &Sec = Sections[SecIndex];
319
320 // Start by getting the section name.
321 auto Name = Obj.getSectionName(Sec, SectionStringTab);
322 if (!Name)
323 return Name.takeError();
324 if (excludeSection(Sec)) {
325 LLVM_DEBUG({
326 dbgs() << " " << SecIndex << ": Skipping section \"" << *Name
327 << "\" explicitly\n";
328 });
329 continue;
330 }
331
332 // Skip null sections.
333 if (Sec.sh_type == ELF::SHT_NULL) {
334 LLVM_DEBUG({
335 dbgs() << " " << SecIndex << ": has type SHT_NULL. Skipping.\n";
336 });
337 continue;
338 }
339
340 // If the name indicates that it's a debug section then skip it: We don't
341 // support those yet.
342 if (!ProcessDebugSections && isDwarfSection(*Name)) {
343 LLVM_DEBUG({
344 dbgs() << " " << SecIndex << ": \"" << *Name
345 << "\" is a debug section: "
346 "No graph section will be created.\n";
347 });
348 continue;
349 }
350
351 LLVM_DEBUG({
352 dbgs() << " " << SecIndex << ": Creating section for \"" << *Name
353 << "\"\n";
354 });
355
356 // Get the section's memory protection flags.
358 if (Sec.sh_flags & ELF::SHF_EXECINSTR)
359 Prot |= orc::MemProt::Exec;
360 if (Sec.sh_flags & ELF::SHF_WRITE)
361 Prot |= orc::MemProt::Write;
362
363 // Look for existing sections first.
364 auto *GraphSec = G->findSectionByName(*Name);
365 if (!GraphSec) {
366 GraphSec = &G->createSection(*Name, Prot);
367 // Non-SHF_ALLOC sections get NoAlloc memory lifetimes.
368 if (!(Sec.sh_flags & ELF::SHF_ALLOC)) {
369 GraphSec->setMemLifetimePolicy(orc::MemLifetimePolicy::NoAlloc);
370 LLVM_DEBUG({
371 dbgs() << " " << SecIndex << ": \"" << *Name
372 << "\" is not a SHF_ALLOC section. Using NoAlloc lifetime.\n";
373 });
374 }
375 }
376
377 if (GraphSec->getMemProt() != Prot) {
378 std::string ErrMsg;
379 raw_string_ostream(ErrMsg)
380 << "In " << G->getName() << ", section " << *Name
381 << " is present more than once with different permissions: "
382 << GraphSec->getMemProt() << " vs " << Prot;
383 return make_error<JITLinkError>(std::move(ErrMsg));
384 }
385
386 Block *B = nullptr;
387 if (Sec.sh_type != ELF::SHT_NOBITS) {
388 auto Data = Obj.template getSectionContentsAsArray<char>(Sec);
389 if (!Data)
390 return Data.takeError();
391
392 B = &G->createContentBlock(*GraphSec, *Data,
393 orc::ExecutorAddr(Sec.sh_addr),
394 Sec.sh_addralign, 0);
395 } else
396 B = &G->createZeroFillBlock(*GraphSec, Sec.sh_size,
397 orc::ExecutorAddr(Sec.sh_addr),
398 Sec.sh_addralign, 0);
399
400 setGraphBlock(SecIndex, B);
401 }
402
403 return Error::success();
404}
405
407 LLVM_DEBUG(dbgs() << " Creating graph symbols...\n");
408
409 // No SYMTAB -- Bail out early.
410 if (!SymTabSec)
411 return Error::success();
412
413 // Get the section content as a Symbols array.
414 auto Symbols = Obj.symbols(SymTabSec);
415 if (!Symbols)
416 return Symbols.takeError();
417
418 // Get the string table for this section.
419 auto StringTab = Obj.getStringTableForSymtab(*SymTabSec, Sections);
420 if (!StringTab)
421 return StringTab.takeError();
422
423 LLVM_DEBUG({
424 StringRef SymTabName;
425
426 if (auto SymTabNameOrErr = Obj.getSectionName(*SymTabSec, SectionStringTab))
427 SymTabName = *SymTabNameOrErr;
428 else {
429 dbgs() << "Could not get ELF SHT_SYMTAB section name for logging: "
430 << toString(SymTabNameOrErr.takeError()) << "\n";
431 SymTabName = "<SHT_SYMTAB section with invalid name>";
432 }
433
434 dbgs() << " Adding symbols from symtab section \"" << SymTabName
435 << "\"\n";
436 });
437
438 for (ELFSymbolIndex SymIndex = 0; SymIndex != Symbols->size(); ++SymIndex) {
439 auto &Sym = (*Symbols)[SymIndex];
440
441 // Check symbol type.
442 switch (Sym.getType()) {
443 case ELF::STT_FILE:
444 LLVM_DEBUG({
445 if (auto Name = Sym.getName(*StringTab))
446 dbgs() << " " << SymIndex << ": Skipping STT_FILE symbol \""
447 << *Name << "\"\n";
448 else {
449 dbgs() << "Could not get STT_FILE symbol name: "
450 << toString(Name.takeError()) << "\n";
451 dbgs() << " " << SymIndex
452 << ": Skipping STT_FILE symbol with invalid name\n";
453 }
454 });
455 continue;
456 break;
457 }
458
459 // Get the symbol name.
460 auto Name = Sym.getName(*StringTab);
461 if (!Name)
462 return Name.takeError();
463
464 // Handle common symbols specially.
465 if (Sym.isCommon()) {
466 Symbol &GSym = G->addDefinedSymbol(
467 G->createZeroFillBlock(getCommonSection(), Sym.st_size,
468 orc::ExecutorAddr(), Sym.getValue(), 0),
469 0, *Name, Sym.st_size, Linkage::Strong, Scope::Default, false, false);
470 setGraphSymbol(SymIndex, GSym);
471 continue;
472 }
473
474 if (Sym.isDefined() &&
475 (Sym.getType() == ELF::STT_NOTYPE || Sym.getType() == ELF::STT_FUNC ||
476 Sym.getType() == ELF::STT_OBJECT ||
477 Sym.getType() == ELF::STT_SECTION || Sym.getType() == ELF::STT_TLS)) {
478
479 // Map Visibility and Binding to Scope and Linkage:
480 Linkage L;
481 Scope S;
482 if (auto LSOrErr = getSymbolLinkageAndScope(Sym, *Name))
483 std::tie(L, S) = *LSOrErr;
484 else
485 return LSOrErr.takeError();
486
487 // Handle extended tables.
488 unsigned Shndx = Sym.st_shndx;
489 if (Shndx == ELF::SHN_XINDEX) {
490 auto ShndxTable = ShndxTables.find(SymTabSec);
491 if (ShndxTable == ShndxTables.end())
492 continue;
493 auto NdxOrErr = object::getExtendedSymbolTableIndex<ELFT>(
494 Sym, SymIndex, ShndxTable->second);
495 if (!NdxOrErr)
496 return NdxOrErr.takeError();
497 Shndx = *NdxOrErr;
498 }
499 if (auto *B = getGraphBlock(Shndx)) {
500 LLVM_DEBUG({
501 dbgs() << " " << SymIndex
502 << ": Creating defined graph symbol for ELF symbol \"" << *Name
503 << "\"\n";
504 });
505
506 TargetFlagsType Flags = makeTargetFlags(Sym);
507 orc::ExecutorAddrDiff Offset = getRawOffset(Sym, Flags);
508
509 if (Offset + Sym.st_size > B->getSize()) {
510 std::string ErrMsg;
511 raw_string_ostream ErrStream(ErrMsg);
512 ErrStream << "In " << G->getName() << ", symbol ";
513 if (!Name->empty())
514 ErrStream << *Name;
515 else
516 ErrStream << "<anon>";
517 ErrStream << " (" << (B->getAddress() + Offset) << " -- "
518 << (B->getAddress() + Offset + Sym.st_size) << ") extends "
519 << formatv("{0:x}", Offset + Sym.st_size - B->getSize())
520 << " bytes past the end of its containing block ("
521 << B->getRange() << ")";
522 return make_error<JITLinkError>(std::move(ErrMsg));
523 }
524
525 // In RISCV, temporary symbols (Used to generate dwarf, eh_frame
526 // sections...) will appear in object code's symbol table, and LLVM does
527 // not use names on these temporary symbols (RISCV gnu toolchain uses
528 // names on these temporary symbols). If the symbol is unnamed, add an
529 // anonymous symbol.
530 auto &GSym =
531 Name->empty()
532 ? G->addAnonymousSymbol(*B, Offset, Sym.st_size,
533 false, false)
534 : G->addDefinedSymbol(*B, Offset, *Name, Sym.st_size, L,
535 S, Sym.getType() == ELF::STT_FUNC,
536 false);
537
538 GSym.setTargetFlags(Flags);
539 setGraphSymbol(SymIndex, GSym);
540 }
541 } else if (Sym.isUndefined() && Sym.isExternal()) {
542 LLVM_DEBUG({
543 dbgs() << " " << SymIndex
544 << ": Creating external graph symbol for ELF symbol \"" << *Name
545 << "\"\n";
546 });
547
548 if (Sym.getBinding() != ELF::STB_GLOBAL &&
549 Sym.getBinding() != ELF::STB_WEAK)
550 return make_error<StringError>(
551 "Invalid symbol binding " +
552 Twine(static_cast<int>(Sym.getBinding())) +
553 " for external symbol " + *Name,
555
556 // If L is Linkage::Weak that means this is a weakly referenced symbol.
557 auto &GSym = G->addExternalSymbol(*Name, Sym.st_size,
558 Sym.getBinding() == ELF::STB_WEAK);
559 setGraphSymbol(SymIndex, GSym);
560 } else if (Sym.isUndefined() && Sym.st_value == 0 && Sym.st_size == 0 &&
561 Sym.getType() == ELF::STT_NOTYPE &&
562 Sym.getBinding() == ELF::STB_LOCAL && Name->empty()) {
563 // Some relocations (e.g., R_RISCV_ALIGN) don't have a target symbol and
564 // use this kind of null symbol as a placeholder.
565 LLVM_DEBUG({
566 dbgs() << " " << SymIndex << ": Creating null graph symbol\n";
567 });
568
569 auto SymName =
570 G->allocateContent("__jitlink_ELF_SYM_UND_" + Twine(SymIndex));
571 auto SymNameRef = StringRef(SymName.data(), SymName.size());
572 auto &GSym = G->addAbsoluteSymbol(SymNameRef, orc::ExecutorAddr(0), 0,
574 setGraphSymbol(SymIndex, GSym);
575 } else {
576 LLVM_DEBUG({
577 dbgs() << " " << SymIndex
578 << ": Not creating graph symbol for ELF symbol \"" << *Name
579 << "\" with unrecognized type\n";
580 });
581 }
582 }
583
584 return Error::success();
585}
586
587template <typename ELFT>
588template <typename RelocHandlerFunction>
590 const typename ELFT::Shdr &RelSect, RelocHandlerFunction &&Func) {
591 // Only look into sections that store relocation entries.
592 if (RelSect.sh_type != ELF::SHT_RELA)
593 return Error::success();
594
595 // sh_info contains the section header index of the target (FixupSection),
596 // which is the section to which all relocations in RelSect apply.
597 auto FixupSection = Obj.getSection(RelSect.sh_info);
598 if (!FixupSection)
599 return FixupSection.takeError();
600
601 // Target sections have names in valid ELF object files.
602 Expected<StringRef> Name = Obj.getSectionName(**FixupSection);
603 if (!Name)
604 return Name.takeError();
605 LLVM_DEBUG(dbgs() << " " << *Name << ":\n");
606
607 // Consider skipping these relocations.
608 if (!ProcessDebugSections && isDwarfSection(*Name)) {
609 LLVM_DEBUG(dbgs() << " skipped (dwarf section)\n\n");
610 return Error::success();
611 }
612 if (excludeSection(**FixupSection)) {
613 LLVM_DEBUG(dbgs() << " skipped (fixup section excluded explicitly)\n\n");
614 return Error::success();
615 }
616
617 // Lookup the link-graph node corresponding to the target section name.
618 auto *BlockToFix = getGraphBlock(RelSect.sh_info);
619 if (!BlockToFix)
620 return make_error<StringError>(
621 "Refencing a section that wasn't added to the graph: " + *Name,
623
624 auto RelEntries = Obj.relas(RelSect);
625 if (!RelEntries)
626 return RelEntries.takeError();
627
628 // Let the callee process relocation entries one by one.
629 for (const typename ELFT::Rela &R : *RelEntries)
630 if (Error Err = Func(R, **FixupSection, *BlockToFix))
631 return Err;
632
633 LLVM_DEBUG(dbgs() << "\n");
634 return Error::success();
635}
636
637template <typename ELFT>
638template <typename RelocHandlerFunction>
640 const typename ELFT::Shdr &RelSect, RelocHandlerFunction &&Func) {
641 // Only look into sections that store relocation entries.
642 if (RelSect.sh_type != ELF::SHT_REL)
643 return Error::success();
644
645 // sh_info contains the section header index of the target (FixupSection),
646 // which is the section to which all relocations in RelSect apply.
647 auto FixupSection = Obj.getSection(RelSect.sh_info);
648 if (!FixupSection)
649 return FixupSection.takeError();
650
651 // Target sections have names in valid ELF object files.
652 Expected<StringRef> Name = Obj.getSectionName(**FixupSection);
653 if (!Name)
654 return Name.takeError();
655 LLVM_DEBUG(dbgs() << " " << *Name << ":\n");
656
657 // Consider skipping these relocations.
658 if (!ProcessDebugSections && isDwarfSection(*Name)) {
659 LLVM_DEBUG(dbgs() << " skipped (dwarf section)\n\n");
660 return Error::success();
661 }
662 if (excludeSection(**FixupSection)) {
663 LLVM_DEBUG(dbgs() << " skipped (fixup section excluded explicitly)\n\n");
664 return Error::success();
665 }
666
667 // Lookup the link-graph node corresponding to the target section name.
668 auto *BlockToFix = getGraphBlock(RelSect.sh_info);
669 if (!BlockToFix)
670 return make_error<StringError>(
671 "Refencing a section that wasn't added to the graph: " + *Name,
673
674 auto RelEntries = Obj.rels(RelSect);
675 if (!RelEntries)
676 return RelEntries.takeError();
677
678 // Let the callee process relocation entries one by one.
679 for (const typename ELFT::Rel &R : *RelEntries)
680 if (Error Err = Func(R, **FixupSection, *BlockToFix))
681 return Err;
682
683 LLVM_DEBUG(dbgs() << "\n");
684 return Error::success();
685}
686
687} // end namespace jitlink
688} // end namespace llvm
689
690#undef DEBUG_TYPE
691
692#endif // LIB_EXECUTIONENGINE_JITLINK_ELFLINKGRAPHBUILDER_H
bbsections prepare
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_DEBUG(X)
Definition: Debug.h:101
std::string Name
Symbol * Sym
Definition: ELF_riscv.cpp:468
#define G(x, y, z)
Definition: MD5.cpp:56
static bool isDwarfSection(const MCObjectFileInfo *FI, const MCSection *Section)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
static ErrorSuccess success()
Create a success value.
Definition: Error.h:334
Tagged union holding either a T or a Error.
Definition: Error.h:474
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Manages the enabling and disabling of subtarget specific features.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
const Elf_Ehdr & getHeader() const
Definition: ELF.h:192
Represents an address in the executor process.
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:642
@ STB_GLOBAL
Definition: ELF.h:1243
@ STB_LOCAL
Definition: ELF.h:1242
@ STB_GNU_UNIQUE
Definition: ELF.h:1245
@ STB_WEAK
Definition: ELF.h:1244
@ ET_REL
Definition: ELF.h:116
@ SHT_REL
Definition: ELF.h:1008
@ SHT_NULL
Definition: ELF.h:999
@ SHT_NOBITS
Definition: ELF.h:1007
@ SHT_SYMTAB
Definition: ELF.h:1001
@ SHT_SYMTAB_SHNDX
Definition: ELF.h:1015
@ SHT_RELA
Definition: ELF.h:1003
@ SHN_XINDEX
Definition: ELF.h:993
@ STV_INTERNAL
Definition: ELF.h:1273
@ STV_HIDDEN
Definition: ELF.h:1274
@ STV_PROTECTED
Definition: ELF.h:1275
@ STV_DEFAULT
Definition: ELF.h:1272
@ SHF_ALLOC
Definition: ELF.h:1089
@ SHF_WRITE
Definition: ELF.h:1086
@ SHF_EXECINSTR
Definition: ELF.h:1092
@ STT_FUNC
Definition: ELF.h:1256
@ STT_NOTYPE
Definition: ELF.h:1254
@ STT_SECTION
Definition: ELF.h:1257
@ STT_FILE
Definition: ELF.h:1258
@ STT_OBJECT
Definition: ELF.h:1255
@ STT_TLS
Definition: ELF.h:1260
std::optional< const char * > toString(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
MemProt
Describes Read/Write/Exec permissions for memory.
Definition: MemoryFlags.h:27
@ NoAlloc
NoAlloc memory should not be allocated by the JITLinkMemoryManager at all.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:440
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition: Error.cpp:90
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
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:1854
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition: STLExtras.h:1884
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858