Merge "Improve existing convert functions (remove unnecessary shuffles/widenings)"
diff --git a/Config.h b/Config.h
index c1f4133..b1ea833 100644
--- a/Config.h
+++ b/Config.h
@@ -1,9 +1,7 @@
 #ifndef BCC_CONFIG_H
 #define BCC_CONFIG_H
 
-#ifdef HAVE_BCC_CONFIG_MK_H
 #include "ConfigFromMk.h"
-#endif
 
 //---------------------------------------------------------------------------
 // Configuration for Disassembler
diff --git a/lib/Disassembler/Disassembler.cpp b/lib/Disassembler/Disassembler.cpp
index 7e325ce..2cff129 100644
--- a/lib/Disassembler/Disassembler.cpp
+++ b/lib/Disassembler/Disassembler.cpp
@@ -94,19 +94,29 @@
     return;
   }
 
+  ALOGI("Writing LLVM disassembly to file: %s\n", OutputFileName);
   // Disassemble the given function
   OS << "Disassembled code: " << Name << "\n";
 
   const llvm::MCAsmInfo *AsmInfo;
   const llvm::MCSubtargetInfo *SubtargetInfo;
-  const llvm::MCDisassembler *Disassmbler;
+  const llvm::MCDisassembler *Disassembler;
   llvm::MCInstPrinter *IP;
 
+  const std::string& TripleName(Compiler::getTargetTriple());
+
   AsmInfo = Target->createMCAsmInfo(Compiler::getTargetTriple());
-  SubtargetInfo = Target->createMCSubtargetInfo(Compiler::getTargetTriple(), "", "");
-  Disassmbler = Target->createMCDisassembler(*SubtargetInfo);
+  SubtargetInfo = Target->createMCSubtargetInfo(TripleName, "", "");
+  Disassembler = Target->createMCDisassembler(*SubtargetInfo);
+
+  const llvm::MCInstrInfo *MII = Target->createMCInstrInfo();
+  const llvm::MCRegisterInfo *MRI = Target->createMCRegInfo(TripleName);
+
   IP = Target->createMCInstPrinter(AsmInfo->getAssemblerDialect(),
-                                   *AsmInfo, *SubtargetInfo);
+                                   *AsmInfo,
+                                   *MII,
+                                   *MRI,
+                                   *SubtargetInfo);
 
   const BufferMemoryObject *BufferMObj = new BufferMemoryObject(Func, FuncSize);
 
@@ -116,7 +126,7 @@
   for (Index = 0; Index < FuncSize; Index += Size) {
     llvm::MCInst Inst;
 
-    if (Disassmbler->getInstruction(Inst, Size, *BufferMObj, Index,
+    if (Disassembler->getInstruction(Inst, Size, *BufferMObj, Index,
                            /* REMOVED */ llvm::nulls(), llvm::nulls())) {
       OS.indent(4);
       OS.write("0x", 2);
@@ -136,7 +146,7 @@
   delete BufferMObj;
 
   delete AsmInfo;
-  delete Disassmbler;
+  delete Disassembler;
   delete IP;
 
   OS.close();
diff --git a/lib/ScriptCRT/build_bc_lib.mk b/lib/ScriptCRT/build_bc_lib.mk
index fd5bc9c..58f5f6e 100644
--- a/lib/ScriptCRT/build_bc_lib.mk
+++ b/lib/ScriptCRT/build_bc_lib.mk
@@ -16,6 +16,12 @@
 
 include $(BUILD_SYSTEM)/base_rules.mk
 
+# We need to pass the +long64 flag to the underlying version of Clang, since
+# we are generating a library for use with Renderscript (64-bit long type,
+# not 32-bit).
+bc_clang_cc1_cflags := -target-feature +long64
+bc_translated_clang_cc1_cflags := $(addprefix -Xclang , $(bc_clang_cc1_cflags))
+
 bc_cflags := -MD \
              -DRS_VERSION=$(RS_VERSION) \
              -std=c99 \
@@ -24,7 +30,8 @@
              -fno-builtin \
              -emit-llvm \
              -ccc-host-triple armv7-none-linux-gnueabi \
-             -fsigned-char
+             -fsigned-char \
+	     $(bc_translated_clang_cc1_cflags)
 
 c_sources := $(filter %.c,$(LOCAL_SRC_FILES))
 ll_sources := $(filter %.ll,$(LOCAL_SRC_FILES))
diff --git a/libbcc-gen-build-stamp.mk b/libbcc-gen-build-stamp.mk
index a2d8374..22fe81d 100644
--- a/libbcc-gen-build-stamp.mk
+++ b/libbcc-gen-build-stamp.mk
@@ -55,7 +55,3 @@
 	$(transform-generated-source)
 
 LOCAL_GENERATED_SOURCES += $(GEN)
-
-LOCAL_CFLAGS := \
-  -DHAVE_BCC_CONFIG_MK_H \
-  $(LOCAL_CFLAGS)