#include "llvm-c/Core.h"
#include "llvm-c/Error.h"
#include "llvm-c/LLJIT.h"
#include "llvm-c/OrcEE.h"
#include "llvm-c/Support.h"
#include "llvm-c/Target.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(_WIN32)
#include <windows.h>
#else
#include <dlfcn.h>
#include <sys/mman.h>
#endif
struct Section { … };
char CtxCtxPlaceholder;
char CtxPlaceholder;
#define MaxSections …
static size_t SectionCount = …;
static struct Section Sections[MaxSections];
void *addSection(size_t Size, LLVMBool IsCode) { … }
void *memCreateContext(void *CtxCtx) { … }
void memNotifyTerminating(void *CtxCtx) { … }
uint8_t *memAllocate(void *Opaque, uintptr_t Size, unsigned Align, unsigned Id,
const char *Name) { … }
uint8_t *memAllocateData(void *Opaque, uintptr_t Size, unsigned Align,
unsigned Id, const char *Name, LLVMBool ReadOnly) { … }
LLVMBool memFinalize(void *Opaque, char **Err) { … }
void memDestroy(void *Opaque) { … }
LLVMOrcObjectLayerRef objectLinkingLayerCreator(void *Opaque,
LLVMOrcExecutionSessionRef ES,
const char *Triple) { … }
int handleError(LLVMErrorRef Err) { … }
LLVMOrcThreadSafeModuleRef createDemoModule(void) { … }
int main(int argc, const char *argv[]) { … }