LLVM: lib/ExecutionEngine/Orc/SectCreate.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
10
11#define DEBUG_TYPE "orc"
12
14
16
18 std::unique_ptr R) {
19 auto G = std::make_unique(
20 "orc_sectcreate_" + SectName,
21 ObjLinkingLayer.getExecutionSession().getSymbolStringPool(),
22 ObjLinkingLayer.getExecutionSession().getTargetTriple(),
24
25 auto &Sect = G->createSection(SectName, MP);
26 auto Content = G->allocateContent(ArrayRef(Data->getBuffer()));
27 auto &B = G->createContentBlock(Sect, Content, ExecutorAddr(), Alignment, 0);
28
29 for (auto &[Name, Info] : ExtraSymbols) {
32 G->addDefinedSymbol(B, Info.Offset, *Name, 0, L, S, Info.Flags.isCallable(),
33 true);
34 }
35
36 ObjLinkingLayer.emit(std::move(R), std::move(G));
37}
38
39void SectCreateMaterializationUnit::discard(const JITDylib &JD,
41 ExtraSymbols.erase(Name);
42}
43
44MaterializationUnit::Interface SectCreateMaterializationUnit::getInterface(
45 const ExtraSymbolsMap &ExtraSymbols) {
47 for (auto &[Name, Info] : ExtraSymbols)
48 SymbolFlags[Name] = Info.Flags;
49 return {std::move(SymbolFlags), nullptr};
50}
51
52}
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool erase(const KeyT &Val)
Manages the enabling and disabling of subtarget specific features.
Represents an address in the executor process.
Represents a JIT'd dynamic library.
void materialize(std::unique_ptr< MaterializationResponsibility > R) override
Implementations of this method should materialize all symbols in the materialzation unit,...
Definition SectCreate.cpp:17
Pointer to a pooled string representing a symbol name.
LLVM_ABI const char * getGenericEdgeKindName(Edge::Kind K)
Returns the string name of the given generic edge kind, or "unknown" otherwise.
DenseMap< SymbolStringPtr, JITSymbolFlags > SymbolFlagsMap
A map from symbol names (as SymbolStringPtrs) to JITSymbolFlags.