24#define DEBUG_TYPE "jitlink"
51 return make_error<JITLinkError>(
"Invalid COFF buffer");
54 return make_error<JITLinkError>(
"Truncated COFF buffer");
63 if (DH->Magic[0] ==
'M' && DH->Magic[1] ==
'Z') {
65 CurPtr = DH->AddressOfNewExeHeader;
68 return make_error<JITLinkError>(
"Incorrect PE magic");
75 return make_error<JITLinkError>(
"Truncated COFF buffer");
86 return make_error<JITLinkError>(
"Truncated COFF buffer");
99 COFFBigObjHeader =
nullptr;
105 dbgs() <<
"jitLink_COFF: PE = " << (IsPE ?
"yes" :
"no")
106 <<
", bigobj = " << (COFFBigObjHeader ?
"yes" :
"no")
115 return make_error<JITLinkError>(
116 "Unsupported target machine architecture in COFF object " +
122 std::unique_ptr<JITLinkContext> Ctx) {
123 switch (
G->getTargetTriple().getArch()) {
128 Ctx->notifyFailed(make_error<JITLinkError>(
129 "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_x86_64(MemoryBufferRef ObjectBuffer)
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.
Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromCOFFObject(MemoryBufferRef ObjectBuffer)
Create a LinkGraph from an COFF relocatable object.
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.