ARM: Generate $t mapping symbol to indicate thumb2 code

According to ARM ELF specification, add $t mapping symbol to oat file
to indicate that the compiled method is thumb2 code.

Change-Id: I31e4eeab0b2be7754127cc90ac40b00216b48009
diff --git a/compiler/elf_writer_quick.cc b/compiler/elf_writer_quick.cc
index c75d8f8..575886b 100644
--- a/compiler/elf_writer_quick.cc
+++ b/compiler/elf_writer_quick.cc
@@ -686,6 +686,13 @@
     symtab->AddSymbol(it->method_name_, &builder->GetTextBuilder(), it->low_pc_, true,
                       it->high_pc_ - it->low_pc_, STB_GLOBAL, STT_FUNC);
 
+    // Conforming to aaelf, add $t mapping symbol to indicate start of a sequence of thumb2
+    // instructions, so that disassembler tools can correctly disassemble.
+    if (it->compiled_method_->GetInstructionSet() == kThumb2) {
+      symtab->AddSymbol("$t", &builder->GetTextBuilder(), it->low_pc_ & ~1, true,
+                        0, STB_LOCAL, STT_NOTYPE);
+    }
+
     // Include CFI for compiled method, if possible.
     if (cfi_info.get() != nullptr) {
       DCHECK(it->compiled_method_ != nullptr);