Various GCC 3.6 and clang build fixes.

Remove #error in common_test.h that fires with clang build and replace with
runtime error.
Fix bit rot caused by not compiling with Wthread-safety.
Fix clang build issues in compiler relating to missing header file definitions
in object files.
Other minor build and tidying issues.

Change-Id: Ife829ab0664581936155be524de46e6181c750b0
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index ab0abb2..03618da 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -385,7 +385,8 @@
 
 static void DoInvoke(Thread* self, MethodHelper& mh, ShadowFrame& shadow_frame,
                      const Instruction* inst, InvokeType type, bool is_range,
-                     JValue* result) {
+                     JValue* result)
+    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
   uint32_t vregC = (is_range) ? inst->VRegC_3rc() : inst->VRegC_35c();
   Object* receiver;
   if (type == kStatic) {
@@ -579,7 +580,8 @@
   }
 }
 
-static inline String* ResolveString(Thread* self, MethodHelper& mh, uint32_t string_idx) {
+static inline String* ResolveString(Thread* self, MethodHelper& mh, uint32_t string_idx)
+    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
   Class* java_lang_string_class = String::GetJavaLangString();
   if (UNLIKELY(!java_lang_string_class->IsInitialized())) {
     ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
@@ -649,7 +651,8 @@
                                                                        uint32_t dex_pc,
                                                                        const uint16_t* insns,
                                                                        SirtRef<Object>& this_object_ref,
-                                                                       instrumentation::Instrumentation* instrumentation) {
+                                                                       instrumentation::Instrumentation* instrumentation)
+    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
   self->VerifyStack();
   ThrowLocation throw_location;
   mirror::Throwable* exception = self->GetException(&throw_location);
@@ -688,7 +691,8 @@
 static void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh)
   __attribute__ ((cold, noreturn, noinline));
 
-static void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh) {
+static void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh)
+    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
   LOG(FATAL) << "Unexpected instruction: " << inst->DumpString(&mh.GetDexFile());
   exit(0);  // Unreachable, keep GCC happy.
 }