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.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'compiler/dwarf/dwarf_test.cc') diff --git a/compiler/dwarf/dwarf_test.cc b/compiler/dwarf/dwarf_test.cc index 98f691a7a1..edba00aeaa 100644 --- a/compiler/dwarf/dwarf_test.cc +++ b/compiler/dwarf/dwarf_test.cc @@ -16,6 +16,7 @@ #include "dwarf_test.h" +#include "dwarf/dwarf_constants.h" #include "dwarf/debug_frame_opcode_writer.h" #include "dwarf/debug_info_entry_writer.h" #include "dwarf/debug_line_opcode_writer.h" @@ -119,7 +120,8 @@ TEST_F(DwarfTest, DebugFrame) { DW_CHECK_NEXT("DW_CFA_restore: r5 (ebp)"); DebugFrameOpCodeWriter<> initial_opcodes; - WriteEhFrameCIE(is64bit, Reg(is64bit ? 16 : 8), initial_opcodes, &eh_frame_data_); + WriteEhFrameCIE(is64bit, DW_EH_PE_absptr, Reg(is64bit ? 16 : 8), + initial_opcodes, &eh_frame_data_); std::vector eh_frame_patches; std::vector expected_patches { 28 }; // NOLINT WriteEhFrameFDE(is64bit, 0, 0x01000000, 0x01000000, opcodes.data(), @@ -132,7 +134,8 @@ TEST_F(DwarfTest, DebugFrame) { TEST_F(DwarfTest, DebugFrame64) { constexpr bool is64bit = true; DebugFrameOpCodeWriter<> initial_opcodes; - WriteEhFrameCIE(is64bit, Reg(16), initial_opcodes, &eh_frame_data_); + WriteEhFrameCIE(is64bit, DW_EH_PE_absptr, Reg(16), + initial_opcodes, &eh_frame_data_); DebugFrameOpCodeWriter<> opcodes; std::vector eh_frame_patches; std::vector expected_patches { 32 }; // NOLINT @@ -170,7 +173,8 @@ TEST_F(DwarfTest, x86_64_RegisterMapping) { DW_CHECK_NEXT("DW_CFA_offset: r14 (r14)"); DW_CHECK_NEXT("DW_CFA_offset: r15 (r15)"); DebugFrameOpCodeWriter<> initial_opcodes; - WriteEhFrameCIE(is64bit, Reg(16), initial_opcodes, &eh_frame_data_); + WriteEhFrameCIE(is64bit, DW_EH_PE_absptr, Reg(16), + initial_opcodes, &eh_frame_data_); std::vector eh_frame_patches; WriteEhFrameFDE(is64bit, 0, 0x0100000000000000, 0x0200000000000000, opcodes.data(), &eh_frame_data_, &eh_frame_patches); -- cgit v1.2.3-59-g8ed1b