Merge pull request #487 from mayerwin/patch-1
[mono.git] / mono / mini / mini-llvm-cpp.cpp
index 42be2e03cb07512ad6b50ddb7217d1ee26131f6d..2b90cd692daac6ad903e56bbb23cbbb5ff4cc6e2 100644 (file)
 // 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
@@ -122,20 +134,16 @@ public:
        }
 
        virtual void* getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure) {
-               if (!strcmp (Name.c_str (), "__bzero")) {
-                       return (void*)bzero;
-               } else {
-                       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;
+               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;
        }
 };
 
@@ -510,9 +518,15 @@ mono_llvm_create_ee (LLVMModuleProviderRef MP, AllocCodeMemoryCb *alloc_cb, Func
 
   force_pass_linking ();
 
+#ifdef TARGET_ARM
+  LLVMInitializeARMTarget ();
+  LLVMInitializeARMTargetInfo ();
+  LLVMInitializeARMTargetMC ();
+#else
   LLVMInitializeX86Target ();
   LLVMInitializeX86TargetInfo ();
   LLVMInitializeX86TargetMC ();
+#endif
 
   mono_mm = new MonoJITMemoryManager ();
   mono_mm->alloc_cb = alloc_cb;