LLVM 22.0.0git
SectCreate.h
Go to the documentation of this file.
1//===---- SectCreate.h -- Emulates ld64's -sectcreate option ----*- 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// Emulates ld64's -sectcreate option.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_SECTCREATE_H
14#define LLVM_EXECUTIONENGINE_ORC_SECTCREATE_H
15
19
20#include <utility>
21#include <vector>
22
23namespace llvm::orc {
24
26public:
29 size_t Offset = 0;
30 };
31
33
35 ObjectLinkingLayer &ObjLinkingLayer, std::string SectName, MemProt MP,
36 uint64_t Alignment, std::unique_ptr<MemoryBuffer> Data,
37 ExtraSymbolsMap ExtraSymbols = ExtraSymbolsMap())
38 : MaterializationUnit(getInterface(ExtraSymbols)),
39 ObjLinkingLayer(ObjLinkingLayer), SectName(std::move(SectName)), MP(MP),
40 Alignment(Alignment), Data(std::move(Data)),
41 ExtraSymbols(std::move(ExtraSymbols)) {}
42
43 StringRef getName() const override { return "SectCreate"; }
44
45 void materialize(std::unique_ptr<MaterializationResponsibility> R) override;
46
47private:
48 void discard(const JITDylib &JD, const SymbolStringPtr &Name) override;
49
50 static Interface getInterface(const ExtraSymbolsMap &ExtraSymbols);
51
52 ObjectLinkingLayer &ObjLinkingLayer;
53 std::string SectName;
54 MemProt MP;
55 uint64_t Alignment;
56 std::unique_ptr<MemoryBuffer> Data;
57 ExtraSymbolsMap ExtraSymbols;
58};
59
60} // namespace llvm::orc
61
62#endif // LLVM_EXECUTIONENGINE_ORC_SECTCREATE_H
#define LLVM_ABI
Definition Compiler.h:213
Flags for symbols in the JIT.
Definition JITSymbol.h:75
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Represents a JIT'd dynamic library.
Definition Core.h:902
An ObjectLayer implementation built on JITLink.
SectCreateMaterializationUnit(ObjectLinkingLayer &ObjLinkingLayer, std::string SectName, MemProt MP, uint64_t Alignment, std::unique_ptr< MemoryBuffer > Data, ExtraSymbolsMap ExtraSymbols=ExtraSymbolsMap())
Definition SectCreate.h:34
StringRef getName() const override
Return the name of this materialization unit.
Definition SectCreate.h:43
DenseMap< SymbolStringPtr, ExtraSymbolInfo > ExtraSymbolsMap
Definition SectCreate.h:32
Pointer to a pooled string representing a symbol name.
MemProt
Describes Read/Write/Exec permissions for memory.
Definition MemoryFlags.h:27
FunctionAddr VTableAddr uintptr_t uintptr_t Data
Definition InstrProf.h:189
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:1869
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:851