xref: /freebsd/contrib/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/ObjectFileInterface.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
1 //===-- ObjectFileInterface.h - MU interface utils for objects --*- 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 // Utilities for building MaterializationUnit::Interface objects from
10 // object files.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_EXECUTIONENGINE_ORC_OBJECTFILEINTERFACE_H
15 #define LLVM_EXECUTIONENGINE_ORC_OBJECTFILEINTERFACE_H
16 
17 #include "llvm/ExecutionEngine/Orc/Core.h"
18 #include "llvm/Support/Compiler.h"
19 #include "llvm/Support/MemoryBuffer.h"
20 
21 namespace llvm {
22 namespace orc {
23 
24 /// Adds an initializer symbol to the given MU interface.
25 /// The init symbol's name is guaranteed to be unique within I, and will be of
26 /// the form $.<ObjFileName>.__inits.<N>, where N is some integer.
27 LLVM_ABI void addInitSymbol(MaterializationUnit::Interface &I,
28                             ExecutionSession &ES, StringRef ObjFileName);
29 
30 /// Returns a MaterializationUnit::Interface for the object file contained in
31 /// the given buffer, or an error if the buffer does not contain a valid object
32 /// file.
33 LLVM_ABI Expected<MaterializationUnit::Interface>
34 getObjectFileInterface(ExecutionSession &ES, MemoryBufferRef ObjBuffer);
35 
36 } // End namespace orc
37 } // End namespace llvm
38 
39 #endif // LLVM_EXECUTIONENGINE_ORC_OBJECTFILEINTERFACE_H
40