Hook up the MCJIT to the RuntimeDyld library.

Lots of cleanup to make the interfaces prettier, use the JITMemoryManager,
handle multiple functions and modules, etc.. This gets far enough that
the MCJIT compiles and runs code, though.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128052 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
index 3186bf2..a57055e 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -145,6 +145,10 @@
     SymbolTable[Name] = Address;
   }
 
+  // We've loaded the section; now mark the functions in it as executable.
+  // FIXME: We really should use the JITMemoryManager for this.
+  sys::Memory::setRangeExecutable(Data.base(), Data.size());
+
   delete SectionBases;
   return false;
 }
@@ -220,12 +224,14 @@
     SymbolTable[Name] = Address;
   }
 
+  // We've loaded the section; now mark the functions in it as executable.
+  // FIXME: We really should use the JITMemoryManager for this.
+  sys::Memory::setRangeExecutable(Data.base(), Data.size());
+
   delete SectionBases;
   return false;
 }
 
-
-
 bool RuntimeDyldImpl::loadObject(MemoryBuffer *InputBuffer) {
   // If the linker is in an error state, don't do anything.
   if (hasError())