diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/elf_writer.cc | 2 | ||||
-rw-r--r-- | compiler/elf_writer_quick.cc | 42 |
2 files changed, 10 insertions, 34 deletions
diff --git a/compiler/elf_writer.cc b/compiler/elf_writer.cc index 4c093c7738..55ee18e8d9 100644 --- a/compiler/elf_writer.cc +++ b/compiler/elf_writer.cc @@ -43,7 +43,7 @@ void ElfWriter::GetOatElfInformation(File* file, size_t& oat_data_offset) { std::string error_msg; std::unique_ptr<ElfFile> elf_file(ElfFile::Open(file, false, false, &error_msg)); - CHECK(elf_file.get() != NULL) << error_msg; + CHECK(elf_file.get() != nullptr) << error_msg; oat_loaded_size = elf_file->GetLoadedSize(); CHECK_NE(0U, oat_loaded_size); diff --git a/compiler/elf_writer_quick.cc b/compiler/elf_writer_quick.cc index 78757ecfe2..e4dcaa7426 100644 --- a/compiler/elf_writer_quick.cc +++ b/compiler/elf_writer_quick.cc @@ -20,6 +20,7 @@ #include "base/unix_file/fd_file.h" #include "buffered_output_stream.h" #include "driver/compiler_driver.h" +#include "dwarf.h" #include "elf_utils.h" #include "file_output_stream.h" #include "globals.h" @@ -469,9 +470,9 @@ bool ElfWriterQuick::ElfBuilder::Write() { pieces.push_back(ElfFilePiece(".hash", hash_builder_.section_.sh_offset, hash.data(), hash.size() * sizeof(Elf32_Word))); pieces.push_back(ElfFilePiece(".rodata", rodata_builder_.section_.sh_offset, - NULL, rodata_builder_.section_.sh_size)); + nullptr, rodata_builder_.section_.sh_size)); pieces.push_back(ElfFilePiece(".text", text_builder_.section_.sh_offset, - NULL, text_builder_.section_.sh_size)); + nullptr, text_builder_.section_.sh_size)); if (IncludingDebugSymbols()) { pieces.push_back(ElfFilePiece(".symtab", symtab_builder_.section_.sh_offset, symtab.data(), symtab.size() * sizeof(Elf32_Sym))); @@ -547,7 +548,7 @@ void ElfWriterQuick::ElfDynamicBuilder::AddDynamicTag(Elf32_Sword tag, Elf32_Wor if (tag == DT_NULL) { return; } - dynamics_.push_back({NULL, tag, d_un}); + dynamics_.push_back({nullptr, tag, d_un}); } void ElfWriterQuick::ElfDynamicBuilder::AddDynamicTag(Elf32_Sword tag, Elf32_Word d_un, @@ -650,7 +651,7 @@ std::vector<Elf32_Word> ElfWriterQuick::ElfSymtabBuilder::GenerateHashContents() // Lets say the state is something like this. // +--------+ +--------+ +-----------+ // | symtab | | bucket | | chain | - // | NULL | | 1 | | STN_UNDEF | + // | nullptr | | 1 | | STN_UNDEF | // | <sym1> | | 4 | | 2 | // | <sym2> | | | | 5 | // | <sym3> | | | | STN_UNDEF | @@ -821,10 +822,10 @@ bool ElfWriterQuick::Write(OatWriter* oat_writer, bool generateDebugInformation = compiler_driver_->GetCallFrameInformation() != nullptr; if (generateDebugInformation) { - ElfRawSectionBuilder debug_info(".debug_info", SHT_PROGBITS, 0, NULL, 0, 1, 0); - ElfRawSectionBuilder debug_abbrev(".debug_abbrev", SHT_PROGBITS, 0, NULL, 0, 1, 0); - ElfRawSectionBuilder debug_str(".debug_str", SHT_PROGBITS, 0, NULL, 0, 1, 0); - ElfRawSectionBuilder debug_frame(".debug_frame", SHT_PROGBITS, 0, NULL, 0, 4, 0); + ElfRawSectionBuilder debug_info(".debug_info", SHT_PROGBITS, 0, nullptr, 0, 1, 0); + ElfRawSectionBuilder debug_abbrev(".debug_abbrev", SHT_PROGBITS, 0, nullptr, 0, 1, 0); + ElfRawSectionBuilder debug_str(".debug_str", SHT_PROGBITS, 0, nullptr, 0, 1, 0); + ElfRawSectionBuilder debug_frame(".debug_frame", SHT_PROGBITS, 0, nullptr, 0, 4, 0); debug_frame.SetBuffer(*compiler_driver_->GetCallFrameInformation()); FillInCFIInformation(oat_writer, debug_info.GetBuffer(), @@ -866,31 +867,6 @@ static void PushHalf(std::vector<uint8_t>*buf, int data) { buf->push_back((data >> 8) & 0xff); } -// DWARF constants needed to generate CFI information. -enum { - // Tag encodings. - DW_TAG_compile_unit = 0x11, - DW_TAG_subprogram = 0X2e, - - // Attribute encodings. - DW_AT_name = 0x03, - DW_AT_low_pc = 0x11, - DW_AT_high_pc = 0x12, - DW_AT_language = 0x13, - - // Constant encoding. - DW_CHILDREN_no = 0x00, - DW_CHILDREN_yes = 0x01, - - // Attribute form encodings. - DW_FORM_addr = 0x01, - DW_FORM_data1 = 0x0b, - DW_FORM_strp = 0x0e, - - // Language encoding. - DW_LANG_Java = 0x000b -}; - void ElfWriterQuick::FillInCFIInformation(OatWriter* oat_writer, std::vector<uint8_t>* dbg_info, std::vector<uint8_t>* dbg_abbrev, |