22#define DEBUG_TYPE "jitlink"
44 std::shared_ptr<orc::SymbolStringPool> SSP) {
50 return make_error<JITLinkError>(
"Invalid COFF buffer");
53 return make_error<JITLinkError>(
"Truncated COFF buffer");
62 if (DH->Magic[0] ==
'M' && DH->Magic[1] ==
'Z') {
64 CurPtr = DH->AddressOfNewExeHeader;
67 return make_error<JITLinkError>(
"Incorrect PE magic");
74 return make_error<JITLinkError>(
"Truncated COFF buffer");
85 return make_error<JITLinkError>(
"Truncated COFF buffer");
98 COFFBigObjHeader =
nullptr;
104 dbgs() <<
"jitLink_COFF: PE = " << (IsPE ?
"yes" :
"no")
105 <<
", bigobj = " << (COFFBigObjHeader ?
"yes" :
"no")
114 return make_error<JITLinkError>(
115 "Unsupported target machine architecture in COFF object " +
121 std::unique_ptr<JITLinkContext> Ctx) {
122 switch (
G->getTargetTriple().getArch()) {
127 Ctx->notifyFailed(make_error<JITLinkError>(
128 "Unsupported target machine architecture in COFF link graph " +
COFF::MachineTypes Machine
Merge contiguous icmps into a memcmp
Tagged union holding either a T or a Error.
StringRef getBufferIdentifier() const
StringRef getBuffer() const
StringRef - Represent a constant reference to a string, i.e.
@ IMAGE_FILE_MACHINE_ARM64
@ IMAGE_FILE_MACHINE_UNKNOWN
@ IMAGE_FILE_MACHINE_AMD64
@ IMAGE_FILE_MACHINE_I386
@ IMAGE_FILE_MACHINE_ARMNT
static const char BigObjMagic[]
static const char PEMagic[]
Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromCOFFObject(MemoryBufferRef ObjectBuffer, std::shared_ptr< orc::SymbolStringPool > SSP)
Create a LinkGraph from an COFF relocatable object.
Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromCOFFObject_x86_64(MemoryBufferRef ObjectBuffer, std::shared_ptr< orc::SymbolStringPool > SSP)
Create a LinkGraph from an COFF/x86-64 relocatable object.
void link_COFF(std::unique_ptr< LinkGraph > G, std::unique_ptr< JITLinkContext > Ctx)
Link the given graph.
static StringRef getMachineName(uint16_t Machine)
void link_COFF_x86_64(std::unique_ptr< LinkGraph > G, std::unique_ptr< JITLinkContext > Ctx)
jit-link the given object buffer, which must be a COFF x86-64 object file.
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.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
@ coff_object
COFF object file.