From 197160d47f34238cb5e7444fa4c2de300db8e2c6 Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Mon, 7 Mar 2016 17:33:57 +0000 Subject: Refactor MethodDebugInfo (input of DWARF writer). Do not pass CompiledMethod pointer through since it is only available during AOT compile but not during JIT compile or at runtime. Creating mock CompiledMethod just pass data is proving increasingly tricky, so copy the fields that we need to MethodDebugInfo instead. Change-Id: I820297b41e769fcac488c0ff2d2ea0492bb13ed8 --- compiler/elf_builder.h | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'compiler/elf_builder.h') diff --git a/compiler/elf_builder.h b/compiler/elf_builder.h index 943e2a897d..42f4e41827 100644 --- a/compiler/elf_builder.h +++ b/compiler/elf_builder.h @@ -164,12 +164,6 @@ class ElfBuilder FINAL { } } - // Returns true if the section was written to disk. - // (Used to check whether we have .text when writing JIT debug info) - bool Exists() const { - return finished_; - } - // Get the location of this section in virtual memory. Elf_Addr GetAddress() const { CHECK(started_); @@ -363,16 +357,18 @@ class ElfBuilder FINAL { void Add(Elf_Word name, const Section* section, Elf_Addr addr, - bool is_relative, Elf_Word size, uint8_t binding, - uint8_t type, - uint8_t other = 0) { - DCHECK(section != nullptr || !is_relative); - Elf_Addr abs_addr = addr + (is_relative ? section->GetAddress() : 0); - Elf_Word section_index = - (section != nullptr) ? section->GetSectionIndex() : static_cast(SHN_ABS); - Add(name, section_index, abs_addr, size, binding, type, other); + uint8_t type) { + Elf_Word section_index; + if (section != nullptr) { + DCHECK_LE(section->GetAddress(), addr); + DCHECK_LE(addr, section->GetAddress() + section->GetSize()); + section_index = section->GetSectionIndex(); + } else { + section_index = static_cast(SHN_ABS); + } + Add(name, section_index, addr, size, binding, type); } void Add(Elf_Word name, @@ -380,13 +376,12 @@ class ElfBuilder FINAL { Elf_Addr addr, Elf_Word size, uint8_t binding, - uint8_t type, - uint8_t other = 0) { + uint8_t type) { Elf_Sym sym = Elf_Sym(); sym.st_name = name; sym.st_value = addr; sym.st_size = size; - sym.st_other = other; + sym.st_other = 0; sym.st_shndx = section_index; sym.st_info = (binding << 4) + (type & 0xf); CachedSection::Add(&sym, sizeof(sym)); -- cgit v1.2.3-59-g8ed1b