1 //===--- MachO_x86_64.h - JIT link functions for MachO/x86-64 ---*- 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 // jit-link functions for MachO/x86-64.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_EXECUTIONENGINE_JITLINK_MACHO_X86_64_H
14 #define LLVM_EXECUTIONENGINE_JITLINK_MACHO_X86_64_H
15 
16 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
17 
18 namespace llvm {
19 namespace jitlink {
20 
21 /// Create a LinkGraph from a MachO/x86-64 relocatable object.
22 ///
23 /// Note: The graph does not take ownership of the underlying buffer, nor copy
24 /// its contents. The caller is responsible for ensuring that the object buffer
25 /// outlives the graph.
26 Expected<std::unique_ptr<LinkGraph>>
27 createLinkGraphFromMachOObject_x86_64(MemoryBufferRef ObjectBuffer);
28 
29 /// jit-link the given LinkGraph.
30 ///
31 /// If PrePrunePasses is empty then a default mark-live pass will be inserted
32 /// that will mark all exported atoms live. If PrePrunePasses is not empty, the
33 /// caller is responsible for including a pass to mark atoms as live.
34 ///
35 /// If PostPrunePasses is empty then a default GOT-and-stubs insertion pass will
36 /// be inserted. If PostPrunePasses is not empty then the caller is responsible
37 /// for including a pass to insert GOT and stub edges.
38 void link_MachO_x86_64(std::unique_ptr<LinkGraph> G,
39                        std::unique_ptr<JITLinkContext> Ctx);
40 
41 /// Returns a pass suitable for splitting __eh_frame sections in MachO/x86-64
42 /// objects.
43 LinkGraphPassFunction createEHFrameSplitterPass_MachO_x86_64();
44 
45 /// Returns a pass suitable for fixing missing edges in an __eh_frame section
46 /// in a MachO/x86-64 object.
47 LinkGraphPassFunction createEHFrameEdgeFixerPass_MachO_x86_64();
48 
49 } // end namespace jitlink
50 } // end namespace llvm
51 
52 #endif // LLVM_EXECUTIONENGINE_JITLINK_MACHO_X86_64_H
53