From 297ed22d71e0c67e7b1a3f188cff7c3874abbe47 Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Wed, 15 Apr 2015 01:18:12 +0100 Subject: [PATCH] Write 64-bit address in DWARF if we are on 64-bit architecture. DWARF includes code address. Make sure they are of the right size. I have kept them as 32-bit until now to keep consistent with the old code. I do not think that having 32-bit addresses was an issue since we were using 32-bit Elf, but since we plan to switch to 64-bit Elf, we should definitely be using 64-bit address. Change-Id: I57138c0dda2d37fc6f0f9329b31d61f38a2d6fcb --- compiler/elf_writer_debug.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/elf_writer_debug.cc b/compiler/elf_writer_debug.cc index cf0adae52..09bb6bcae 100644 --- a/compiler/elf_writer_debug.cc +++ b/compiler/elf_writer_debug.cc @@ -208,6 +208,7 @@ void WriteDebugSections(const CompilerDriver* compiler, std::vector* debug_line_patches) { const std::vector& method_infos = oat_writer->GetMethodDebugInfo(); const InstructionSet isa = compiler->GetInstructionSet(); + const bool is64bit = Is64BitInstructionSet(isa); // Find all addresses (low_pc) which contain deduped methods. // The first instance of method is not marked deduped_, but the rest is. @@ -245,7 +246,7 @@ void WriteDebugSections(const CompilerDriver* compiler, } size_t debug_abbrev_offset = debug_abbrev->size(); - DebugInfoEntryWriter<> info(false /* 32 bit */, debug_abbrev); + DebugInfoEntryWriter<> info(is64bit, debug_abbrev); info.StartTag(DW_TAG_compile_unit, DW_CHILDREN_yes); info.WriteStrp(DW_AT_producer, "Android dex2oat", debug_str); info.WriteData1(DW_AT_language, DW_LANG_Java); @@ -290,7 +291,7 @@ void WriteDebugSections(const CompilerDriver* compiler, case kX86_64: break; } - DebugLineOpCodeWriter<> opcodes(false /* 32bit */, code_factor_bits_); + DebugLineOpCodeWriter<> opcodes(is64bit, code_factor_bits_); opcodes.SetAddress(cunit_low_pc); if (dwarf_isa != -1) { opcodes.SetISA(dwarf_isa); -- 2.11.0