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
22namespace llvm::orc {
23
25public:
28 size_t Offset = 0;
29 };
30
32
34 ObjectLinkingLayer &ObjLinkingLayer, std::string SectName, MemProt MP,
35 uint64_t Alignment, std::unique_ptr<MemoryBuffer> Data,
36 ExtraSymbolsMap ExtraSymbols = ExtraSymbolsMap())
37 : MaterializationUnit(getInterface(ExtraSymbols)),
38 ObjLinkingLayer(ObjLinkingLayer), SectName(std::move(SectName)), MP(MP),
39 Alignment(Alignment), Data(std::move(Data)),
40 ExtraSymbols(std::move(ExtraSymbols)) {}
41
42 StringRef getName() const override { return "SectCreate"; }
43
44 void materialize(std::unique_ptr<MaterializationResponsibility> R) override;
45
46private:
47 void discard(const JITDylib &JD, const SymbolStringPtr &Name) override;
48
49 static Interface getInterface(const ExtraSymbolsMap &ExtraSymbols);
50
51 ObjectLinkingLayer &ObjLinkingLayer;
52 std::string SectName;
53 MemProt MP;
54 uint64_t Alignment;
55 std::unique_ptr<MemoryBuffer> Data;
56 ExtraSymbolsMap ExtraSymbols;
57};
58
59} // namespace llvm::orc
60
61#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:906
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:33
StringRef getName() const override
Return the name of this materialization unit.
Definition SectCreate.h:42
DenseMap< SymbolStringPtr, ExtraSymbolInfo > ExtraSymbolsMap
Definition SectCreate.h:31
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:1867
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:867