Implement Link-loading and pass 62 tests in JniInternalTest.

The passed tests include the 12 originally ARM-only tests. Now it works
on x86 as well if defined(ART_USE_LLVM_COMPILER).

Change-Id: I03092637fa4f0979ca77e0cac06e5d31a867e465
diff --git a/src/common_test.h b/src/common_test.h
index 7083b8c..7087c70 100644
--- a/src/common_test.h
+++ b/src/common_test.h
@@ -24,6 +24,7 @@
 #include "class_linker.h"
 #include "class_loader.h"
 #include "compiler.h"
+#include "compiler_llvm/utils_llvm.h"
 #include "constants.h"
 #include "dex_file.h"
 #include "file.h"
@@ -174,8 +175,10 @@
   }
 
   static void MakeExecutable(const std::vector<uint8_t>& code) {
+#if !defined(ART_USE_LLVM_COMPILER)  // LLVM compilation uses ELF instead
     CHECK_NE(code.size(), 0U);
     MakeExecutable(&code[0], code.size());
+#endif
   }
 
   // Create an OatMethod based on pointers (for unit tests)
@@ -232,7 +235,11 @@
                                                       &compiled_method->GetVmapTable()[0],
                                                       NULL,
                                                       method_invoke_stub);
+#if !defined(ART_USE_LLVM_COMPILER)
       oat_method.LinkMethodPointers(method);
+#else
+      LLVMLinkLoadMethod("-0", method);
+#endif
     } else {
       MakeExecutable(runtime_->GetAbstractMethodErrorStubArray());
       const void* method_code = runtime_->GetAbstractMethodErrorStubArray()->GetData();