diff options
author | David Srbecky <dsrbecky@google.com> | 2015-04-12 11:40:39 +0100 |
---|---|---|
committer | David Srbecky <dsrbecky@google.com> | 2015-04-13 21:24:12 +0100 |
commit | 8dc7324da5bd0f2afd2ab558ab04882329a61fe8 (patch) | |
tree | 245ce4265cc31990fa6d2f6e792ccd9d44af1dc1 /compiler/elf_writer_quick.cc | |
parent | 4af290af4e89cfbc3a4e1ada79909ccee353361a (diff) | |
download | art-8dc7324da5bd0f2afd2ab558ab04882329a61fe8.zip art-8dc7324da5bd0f2afd2ab558ab04882329a61fe8.tar.gz art-8dc7324da5bd0f2afd2ab558ab04882329a61fe8.tar.bz2 |
Add --include-cfi compiler option.
Decouple generation of CFI from the rest of debug symbols.
This makes it possible to generate oat with CFI but without
the rest of debug symbols.
This is in line with intention of the .eh_frame section.
The section does not have the .debug_ prefix because it
is considered somewhat different to the rest of debug symbols.
Change-Id: I32816ecd4f30ac4e0dc69d69a4993e349c737f96
Diffstat (limited to 'compiler/elf_writer_quick.cc')
-rw-r--r-- | compiler/elf_writer_quick.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/elf_writer_quick.cc b/compiler/elf_writer_quick.cc index da1f81a..737b9d6 100644 --- a/compiler/elf_writer_quick.cc +++ b/compiler/elf_writer_quick.cc @@ -144,6 +144,16 @@ bool ElfWriterQuick<Elf_Word, Elf_Sword, Elf_Addr, Elf_Dyn, return false; } + if (compiler_driver_->GetCompilerOptions().GetIncludeCFI() && + !oat_writer->GetMethodDebugInfo().empty()) { + ElfRawSectionBuilder<Elf_Word, Elf_Sword, Elf_Shdr> eh_frame( + ".eh_frame", SHT_PROGBITS, SHF_ALLOC, nullptr, 0, 4, 0); + dwarf::WriteEhFrame(compiler_driver_, oat_writer, + builder->GetTextBuilder().GetSection()->sh_addr, + eh_frame.GetBuffer()); + builder->RegisterRawSection(eh_frame); + } + if (compiler_driver_->GetCompilerOptions().GetIncludeDebugSymbols() && !oat_writer->GetMethodDebugInfo().empty()) { WriteDebugSymbols(compiler_driver_, builder.get(), oat_writer); @@ -198,7 +208,6 @@ static void WriteDebugSymbols(const CompilerDriver* compiler_driver, } typedef ElfRawSectionBuilder<Elf_Word, Elf_Sword, Elf_Shdr> Section; - Section eh_frame(".eh_frame", SHT_PROGBITS, SHF_ALLOC, nullptr, 0, 4, 0); Section debug_info(".debug_info", SHT_PROGBITS, 0, nullptr, 0, 1, 0); Section debug_abbrev(".debug_abbrev", SHT_PROGBITS, 0, nullptr, 0, 1, 0); Section debug_str(".debug_str", SHT_PROGBITS, 0, nullptr, 0, 1, 0); @@ -207,13 +216,11 @@ static void WriteDebugSymbols(const CompilerDriver* compiler_driver, dwarf::WriteDebugSections(compiler_driver, oat_writer, builder->GetTextBuilder().GetSection()->sh_addr, - eh_frame.GetBuffer(), debug_info.GetBuffer(), debug_abbrev.GetBuffer(), debug_str.GetBuffer(), debug_line.GetBuffer()); - builder->RegisterRawSection(eh_frame); builder->RegisterRawSection(debug_info); builder->RegisterRawSection(debug_abbrev); builder->RegisterRawSection(debug_str); |