Minor refactoring of ElfBuilder.
* Nest section builder classes within the main builder
class to reduce verbosity caused by templates.
* Move .eh_frame and .eh_frame_hdr section headers earlier
so that the section headers are sorted by file offset.
* Do not emit PT_NULL header if .eh_frame_hdr is missing.
None of these changes should have any material impact.
This CL just prepares ground for the following CL.
Change-Id: I56f9825892adb01d413a18ca10cb5c805cb8cd78
diff --git a/compiler/elf_writer_quick.cc b/compiler/elf_writer_quick.cc
index 3b2ca94..9ff94e9 100644
--- a/compiler/elf_writer_quick.cc
+++ b/compiler/elf_writer_quick.cc
@@ -141,7 +141,7 @@
InstructionSet isa = compiler_driver_->GetInstructionSet();
int alignment = GetInstructionSetPointerSize(isa);
- typedef ElfRawSectionBuilder<ElfTypes> RawSection;
+ typedef typename ElfBuilder<ElfTypes>::ElfRawSectionBuilder RawSection;
RawSection eh_frame(".eh_frame", SHT_PROGBITS, SHF_ALLOC, nullptr, 0, alignment, 0);
RawSection eh_frame_hdr(".eh_frame_hdr", SHT_PROGBITS, SHF_ALLOC, nullptr, 0, 4, 0);
RawSection debug_info(".debug_info", SHT_PROGBITS, 0, nullptr, 0, 1, 0);
@@ -230,7 +230,7 @@
}
}
- ElfSymtabBuilder<ElfTypes>* symtab = builder->GetSymtabBuilder();
+ auto* symtab = builder->GetSymtabBuilder();
for (auto it = method_info.begin(); it != method_info.end(); ++it) {
std::string name = PrettyMethod(it->dex_method_index_, *it->dex_file_, true);
if (deduped_addresses.find(it->low_pc_) != deduped_addresses.end()) {