LLVM 20.0.0git
MachO.h
Go to the documentation of this file.
1//===------- MachO.h - Generic JIT link function for MachO ------*- 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 jit-link functions for MachO.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_JITLINK_MACHO_H
14#define LLVM_EXECUTIONENGINE_JITLINK_MACHO_H
15
18
19namespace llvm {
20namespace jitlink {
21
22/// Create a LinkGraph from a MachO relocatable object.
23///
24/// Note: The graph does not take ownership of the underlying buffer, nor copy
25/// its contents. The caller is responsible for ensuring that the object buffer
26/// outlives the graph.
27Expected<std::unique_ptr<LinkGraph>>
28createLinkGraphFromMachOObject(MemoryBufferRef ObjectBuffer,
29 std::shared_ptr<orc::SymbolStringPool> SSP);
30
31/// jit-link the given ObjBuffer, which must be a MachO object file.
32///
33/// Uses conservative defaults for GOT and stub handling based on the target
34/// platform.
35void link_MachO(std::unique_ptr<LinkGraph> G,
36 std::unique_ptr<JITLinkContext> Ctx);
37
38/// Get a pointer to the standard MachO data section (creates an empty
39/// section with RW- permissions and standard lifetime if one does not
40/// already exist).
42 if (auto *DataSec = G.findSectionByName(orc::MachODataDataSectionName))
43 return *DataSec;
44 return G.createSection(orc::MachODataDataSectionName,
46}
47
48/// Get a pointer to the standard MachO text section (creates an empty
49/// section with R-X permissions and standard lifetime if one does not
50/// already exist).
52 if (auto *TextSec = G.findSectionByName(orc::MachOTextTextSectionName))
53 return *TextSec;
54 return G.createSection(orc::MachOTextTextSectionName,
56}
57
58} // end namespace jitlink
59} // end namespace llvm
60
61#endif // LLVM_EXECUTIONENGINE_JITLINK_MACHO_H
#define G(x, y, z)
Definition: MD5.cpp:56
StringRef MachODataDataSectionName
StringRef MachOTextTextSectionName
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18