From 8dc7324da5bd0f2afd2ab558ab04882329a61fe8 Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Sun, 12 Apr 2015 11:40:39 +0100 Subject: 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 --- compiler/elf_writer_quick.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'compiler/elf_writer_quick.cc') 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 ElfWriterQuickGetCompilerOptions().GetIncludeCFI() && + !oat_writer->GetMethodDebugInfo().empty()) { + ElfRawSectionBuilder 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 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); -- cgit v1.1