16#define DEBUG_TYPE "orc"
24 return CPUType.takeError();
28 return CPUSubType.takeError();
36 return BinFile.takeError();
38 std::unique_ptr<object::MachOObjectFile> MachOFile;
41 else if (
auto *MachOUni =
43 for (
auto &O : MachOUni->objects()) {
44 if (O.getCPUType() == *CPUType &&
46 if (
auto Obj = O.getAsObjectFile())
47 MachOFile = std::move(*Obj);
49 return Obj.takeError();
55 " does not contain a slice for " +
67 for (
auto &Sym : MachOFile->symbols()) {
68 if (
auto Name = Sym.getName())
69 Symbols.insert(ES.
intern(*Name));
71 return Name.takeError();
74 return std::move(Symbols);
88 return Tapi.takeError();
92 return CPUType.takeError();
96 return CPUSubType.takeError();
98 auto &IF = (*Tapi)->getInterfaceFile();
102 return Interface.takeError();
104 for (
auto *Sym : (*Interface)->exports())
105 Symbols.insert(ES.
intern(Sym->getName()));
123 " unrecognized file type",
Tagged union holding either a T or a Error.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, bool IsVolatile=false, std::optional< Align > Alignment=std::nullopt)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
const std::string & str() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static Expected< std::unique_ptr< TapiUniversal > > create(MemoryBufferRef Source)
An ExecutionSession represents a running JIT program.
const Triple & getTargetTriple() const
Return the triple for the executor.
SymbolStringPtr intern(StringRef SymName)
Add a symbol name to the SymbolStringPool and return a pointer to it.
LLVM_ABI Expected< uint32_t > getCPUSubType(const Triple &T)
LLVM_ABI Architecture getArchitectureFromCpuType(uint32_t CPUType, uint32_t CPUSubType)
Convert a CPU Type and Subtype pair to an architecture slice.
LLVM_ABI Expected< uint32_t > getCPUType(const Triple &T)
LLVM_ABI Expected< std::unique_ptr< Binary > > createBinary(MemoryBufferRef Source, LLVMContext *Context=nullptr, bool InitContent=true)
Create a Binary from Source, autodetecting the file type.
LLVM_ABI Expected< SymbolNameSet > getDylibInterfaceFromDylib(ExecutionSession &ES, Twine Path)
Returns a SymbolNameSet containing the exported symbols defined in the given dylib.
LLVM_ABI Expected< SymbolNameSet > getDylibInterface(ExecutionSession &ES, Twine Path)
Returns a SymbolNameSet containing the exported symbols defined in the relevant slice of the given fi...
LLVM_ABI Expected< SymbolNameSet > getDylibInterfaceFromTapiFile(ExecutionSession &ES, Twine Path)
Returns a SymbolNameSet containing the exported symbols defined in the relevant slice of the TapiUniv...
DenseSet< SymbolStringPtr > SymbolNameSet
A set of symbol names (represented by SymbolStringPtrs for.
LLVM_ABI file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
Error createFileError(const Twine &F, Error E)
Concatenate a source file path and/or name with an Error.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...
@ macho_dynamically_linked_shared_lib
Mach-O dynlinked shared lib.
@ macho_universal_binary
Mach-O universal binary.
@ tapi_file
Text-based Dynamic Library Stub file.