// possible
//
+#include "config.h"
+//undef those as llvm defines them on its own config.h as well.
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+
#include <stdint.h>
#include <llvm/Support/raw_ostream.h>
((LLVM_MAJOR_VERSION > (major)) || \
((LLVM_MAJOR_VERSION == (major)) && (LLVM_MINOR_VERSION >= (minor))))
+// extern "C" void LLVMInitializeARMTargetInfo();
+// extern "C" void LLVMInitializeARMTarget ();
+// extern "C" void LLVMInitializeARMTargetMC ();
+
using namespace llvm;
class MonoJITMemoryManager : public JITMemoryManager
public:
/* Callbacks installed by mono */
AllocCodeMemoryCb *alloc_cb;
+ DlSymCb *dlsym_cb;
MonoJITMemoryManager ();
~MonoJITMemoryManager ();
}
virtual void* getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure) {
- if (!strcmp (Name.c_str (), "__bzero")) {
- return (void*)bzero;
- } else {
- outs () << "Unable to resolve: " << Name << "\n";
+ void *res;
+ char *err;
+
+ err = dlsym_cb (Name.c_str (), &res);
+ if (err) {
+ outs () << "Unable to resolve: " << Name << ": " << err << "\n";
assert(0);
return NULL;
}
+ return res;
}
};
}
LLVMExecutionEngineRef
-mono_llvm_create_ee (LLVMModuleProviderRef MP, AllocCodeMemoryCb *alloc_cb, FunctionEmittedCb *emitted_cb, ExceptionTableCb *exception_cb)
+mono_llvm_create_ee (LLVMModuleProviderRef MP, AllocCodeMemoryCb *alloc_cb, FunctionEmittedCb *emitted_cb, ExceptionTableCb *exception_cb, DlSymCb *dlsym_cb)
{
std::string Error;
force_pass_linking ();
+#ifdef TARGET_ARM
+ LLVMInitializeARMTarget ();
+ LLVMInitializeARMTargetInfo ();
+ LLVMInitializeARMTargetMC ();
+#else
LLVMInitializeX86Target ();
LLVMInitializeX86TargetInfo ();
LLVMInitializeX86TargetMC ();
+#endif
mono_mm = new MonoJITMemoryManager ();
mono_mm->alloc_cb = alloc_cb;
+ mono_mm->dlsym_cb = dlsym_cb;
//JITExceptionHandling = true;
// PrettyStackTrace installs signal handlers which trip up libgc