From 527c9c71f0c6e2f9943ac028e7c050500699a44b Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Fri, 17 Apr 2015 21:14:10 +0100 Subject: Generate .eh_frame_hdr section and PT_GNU_EH_FRAME segment. Fixes issue 20125400 - ART: Need .eh_frame_hdr and PT_GNU_EH_FRAME for libunwind. .eh_frame_hdr serves two purposes. Firstly, it can optionally contain binary search table for fast eh_frame lookup. This is important for C++ exception handling, but we do not need it so we omit it. Secondly, it contains a relative .eh_frame pointer which makes it easier for run-time code to locate the .eh_frame section. libunwind seems to rely on this relative pointer. Bug: 20125400 Change-Id: I7c1e3f68d914f70781404c508395831a3296a7da --- compiler/dwarf/dwarf_test.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'compiler/dwarf/dwarf_test.h') diff --git a/compiler/dwarf/dwarf_test.h b/compiler/dwarf/dwarf_test.h index dd5e0c286e..cbe700ac74 100644 --- a/compiler/dwarf/dwarf_test.h +++ b/compiler/dwarf/dwarf_test.h @@ -100,30 +100,30 @@ class DwarfTest : public CommonRuntimeTest { Elf_Sym, Elf_Ehdr, Elf_Phdr, Elf_Shdr> builder( &code, file.GetFile(), isa, 0, 0, 0, 0, 0, 0, false, false); typedef ElfRawSectionBuilder Section; + 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); + Section debug_line(".debug_line", SHT_PROGBITS, 0, nullptr, 0, 1, 0); + Section eh_frame(".eh_frame", SHT_PROGBITS, SHF_ALLOC, nullptr, 0, 4, 0); if (!debug_info_data_.empty()) { - Section debug_info(".debug_info", SHT_PROGBITS, 0, nullptr, 0, 1, 0); debug_info.SetBuffer(debug_info_data_); - builder.RegisterRawSection(debug_info); + builder.RegisterRawSection(&debug_info); } if (!debug_abbrev_data_.empty()) { - Section debug_abbrev(".debug_abbrev", SHT_PROGBITS, 0, nullptr, 0, 1, 0); debug_abbrev.SetBuffer(debug_abbrev_data_); - builder.RegisterRawSection(debug_abbrev); + builder.RegisterRawSection(&debug_abbrev); } if (!debug_str_data_.empty()) { - Section debug_str(".debug_str", SHT_PROGBITS, 0, nullptr, 0, 1, 0); debug_str.SetBuffer(debug_str_data_); - builder.RegisterRawSection(debug_str); + builder.RegisterRawSection(&debug_str); } if (!debug_line_data_.empty()) { - Section debug_line(".debug_line", SHT_PROGBITS, 0, nullptr, 0, 1, 0); debug_line.SetBuffer(debug_line_data_); - builder.RegisterRawSection(debug_line); + builder.RegisterRawSection(&debug_line); } if (!eh_frame_data_.empty()) { - Section eh_frame(".eh_frame", SHT_PROGBITS, SHF_ALLOC, nullptr, 0, 4, 0); eh_frame.SetBuffer(eh_frame_data_); - builder.RegisterRawSection(eh_frame); + builder.RegisterRawSection(&eh_frame); } builder.Init(); builder.Write(); -- cgit v1.2.3-59-g8ed1b