From: David Srbecky Date: Thu, 21 May 2015 18:11:18 +0000 (+0100) Subject: Generate just single ARM mapping symbol. X-Git-Tag: android-x86-7.1-r1~889^2~1176^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=388d2861ce185fe9bbf1989f1467031467bd1de7;p=android-x86%2Fart.git Generate just single ARM mapping symbol. It is unnecessary to keep repeating the $t symbol if there are no $d symbols. The last $t should still be in effect. This shrinks the .symtab section by half. Change-Id: Ic57c8c2d412c10f0d040e966379ec524ece87d4a --- diff --git a/compiler/elf_writer_quick.cc b/compiler/elf_writer_quick.cc index 96dd7ca62..5d03eebb3 100644 --- a/compiler/elf_writer_quick.cc +++ b/compiler/elf_writer_quick.cc @@ -45,6 +45,15 @@ namespace art { // because if they need it sometimes, they might as well always use it. constexpr dwarf::CFIFormat kCFIFormat = dwarf::DW_EH_FRAME_FORMAT; +// The ARM specification defines three special mapping symbols +// $a, $t and $d which mark ARM, Thumb and data ranges respectively. +// These symbols can be used by tools, for example, to pretty +// print instructions correctly. Objdump will use them if they +// exist, but it will still work well without them. +// However, these extra symbols take space, so let's just generate +// one symbol which marks the whole .text section as code. +constexpr bool kGenerateSingleArmMappingSymbol = true; + template bool ElfWriterQuick::Create(File* elf_file, OatWriter* oat_writer, @@ -245,6 +254,7 @@ bool ElfWriterQuick::Write( template static void WriteDebugSymbols(ElfBuilder* builder, OatWriter* oat_writer) { const std::vector& method_info = oat_writer->GetMethodDebugInfo(); + bool generated_mapping_symbol = false; // Find all addresses (low_pc) which contain deduped methods. // The first instance of method is not marked deduped_, but the rest is. @@ -273,9 +283,14 @@ static void WriteDebugSymbols(ElfBuilder* builder, OatWriter* oat_writ // Conforming to aaelf, add $t mapping symbol to indicate start of a sequence of thumb2 // instructions, so that disassembler tools can correctly disassemble. + // Note that even if we generate just a single mapping symbol, ARM's Streamline + // requires it to match function symbol. Just address 0 does not work. if (it->compiled_method_->GetInstructionSet() == kThumb2) { - symtab->AddSymbol("$t", builder->GetText(), it->low_pc_ & ~1, true, - 0, STB_LOCAL, STT_NOTYPE); + if (!generated_mapping_symbol || !kGenerateSingleArmMappingSymbol) { + symtab->AddSymbol("$t", builder->GetText(), it->low_pc_ & ~1, true, + 0, STB_LOCAL, STT_NOTYPE); + generated_mapping_symbol = true; + } } } }