diff options
author | David Srbecky <dsrbecky@google.com> | 2015-05-21 19:11:18 +0100 |
---|---|---|
committer | David Srbecky <dsrbecky@google.com> | 2015-05-22 13:54:20 +0100 |
commit | 388d2861ce185fe9bbf1989f1467031467bd1de7 (patch) | |
tree | adbde64db6d25258ca8387c17873fdb44819492c /compiler/elf_writer_quick.cc | |
parent | 1d637745bf1a47db6b899f0c004746ada2fd3f58 (diff) | |
download | art-388d2861ce185fe9bbf1989f1467031467bd1de7.tar.gz art-388d2861ce185fe9bbf1989f1467031467bd1de7.tar.bz2 art-388d2861ce185fe9bbf1989f1467031467bd1de7.zip |
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
Diffstat (limited to 'compiler/elf_writer_quick.cc')
-rw-r--r-- | compiler/elf_writer_quick.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/compiler/elf_writer_quick.cc b/compiler/elf_writer_quick.cc index 96dd7ca62d..5d03eebb34 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 <typename ElfTypes> bool ElfWriterQuick<ElfTypes>::Create(File* elf_file, OatWriter* oat_writer, @@ -245,6 +254,7 @@ bool ElfWriterQuick<ElfTypes>::Write( template <typename ElfTypes> static void WriteDebugSymbols(ElfBuilder<ElfTypes>* builder, OatWriter* oat_writer) { const std::vector<OatWriter::DebugInfo>& 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<ElfTypes>* 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; + } } } } |