13#define DEBUG_TYPE "orc"
18static Expected<std::unique_ptr<MemoryBuffer>>
22 return std::move(Obj);
28 return std::move(Obj);
37 std::optional<Triple::ObjectFormatType> RequireFormat;
39 RequireFormat = TT.getObjectFormat();
47 if (!RequireFormat || *RequireFormat ==
Triple::ELF)
62 return make_error<StringError>(
63 Path +
" does not contain a relocatable object file compatible with " +
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,...
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
Expected< std::unique_ptr< MemoryBuffer > > checkMachORelocatableObject(std::unique_ptr< MemoryBuffer > Obj, const Triple &TT, bool ObjIsSlice)
Check that the given buffer contains a MachO object file compatible with the given triple.
Expected< std::unique_ptr< MemoryBuffer > > loadRelocatableObject(StringRef Path, const Triple &TT)
static Expected< std::unique_ptr< MemoryBuffer > > checkCOFFRelocatableObject(std::unique_ptr< MemoryBuffer > Obj, const Triple &TT)
Expected< std::unique_ptr< MemoryBuffer > > loadMachORelocatableObjectFromUniversalBinary(StringRef UBPath, std::unique_ptr< MemoryBuffer > UBBuf, const Triple &TT)
Load a compatible relocatable object (if available) from a MachO universal binary.
static Expected< std::unique_ptr< MemoryBuffer > > checkELFRelocatableObject(std::unique_ptr< MemoryBuffer > Obj, const Triple &TT)
This is an optimization pass for GlobalISel generic memory operations.
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.
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
@ elf_relocatable
ELF Relocatable object file.
@ macho_universal_binary
Mach-O universal binary.
@ macho_object
Mach-O Object file.
@ coff_object
COFF object file.