X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gold%2Fmapfile.cc;h=907df97d042517d041686df630ac6af5550f3ada;hb=234c306803e0b3c423b3935562a029f3bad04482;hp=a3ba52ba611b73b69ec8245549704701741ad153;hpb=eff458138e2978ee9a3aef4ebee40d53da11e764;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/mapfile.cc b/gold/mapfile.cc index a3ba52ba61..907df97d04 100644 --- a/gold/mapfile.cc +++ b/gold/mapfile.cc @@ -1,6 +1,6 @@ // mapfile.cc -- map file generation for gold -// Copyright 2008 Free Software Foundation, Inc. +// Copyright (C) 2008-2019 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -202,7 +202,7 @@ Mapfile::print_memory_map_header() template void Mapfile::print_input_section_symbols( - const Sized_relobj* relobj, + const Sized_relobj_file* relobj, unsigned int shndx) { unsigned int symcount = relobj->symbol_count(); @@ -258,8 +258,11 @@ Mapfile::print_input_section(Relobj* relobj, unsigned int shndx) } char sizebuf[50]; + section_size_type size; + if (!relobj->section_is_compressed(shndx, &size)) + size = relobj->section_size(shndx); snprintf(sizebuf, sizeof sizebuf, "0x%llx", - static_cast(relobj->section_size(shndx))); + static_cast(size)); fprintf(this->map_file_, "0x%0*llx %10s %s\n", parameters->target().get_size() / 4, @@ -273,8 +276,8 @@ Mapfile::print_input_section(Relobj* relobj, unsigned int shndx) #ifdef HAVE_TARGET_32_LITTLE case Parameters::TARGET_32_LITTLE: { - const Sized_relobj<32, false>* sized_relobj = - static_cast*>(relobj); + const Sized_relobj_file<32, false>* sized_relobj = + static_cast*>(relobj); this->print_input_section_symbols(sized_relobj, shndx); } break; @@ -282,8 +285,8 @@ Mapfile::print_input_section(Relobj* relobj, unsigned int shndx) #ifdef HAVE_TARGET_32_BIG case Parameters::TARGET_32_BIG: { - const Sized_relobj<32, true>* sized_relobj = - static_cast*>(relobj); + const Sized_relobj_file<32, true>* sized_relobj = + static_cast*>(relobj); this->print_input_section_symbols(sized_relobj, shndx); } break; @@ -291,8 +294,8 @@ Mapfile::print_input_section(Relobj* relobj, unsigned int shndx) #ifdef HAVE_TARGET_64_LITTLE case Parameters::TARGET_64_LITTLE: { - const Sized_relobj<64, false>* sized_relobj = - static_cast*>(relobj); + const Sized_relobj_file<64, false>* sized_relobj = + static_cast*>(relobj); this->print_input_section_symbols(sized_relobj, shndx); } break; @@ -300,8 +303,8 @@ Mapfile::print_input_section(Relobj* relobj, unsigned int shndx) #ifdef HAVE_TARGET_64_BIG case Parameters::TARGET_64_BIG: { - const Sized_relobj<64, true>* sized_relobj = - static_cast*>(relobj); + const Sized_relobj_file<64, true>* sized_relobj = + static_cast*>(relobj); this->print_input_section_symbols(sized_relobj, shndx); } break; @@ -328,11 +331,13 @@ Mapfile::print_output_data(const Output_data* od, const char* name) char sizebuf[50]; snprintf(sizebuf, sizeof sizebuf, "0x%llx", - static_cast(od->data_size())); + static_cast(od->current_data_size())); fprintf(this->map_file_, "0x%0*llx %10s\n", parameters->target().get_size() / 4, - static_cast(od->address()), + (od->is_address_valid() + ? static_cast(od->address()) + : 0), sizebuf); } @@ -347,6 +352,12 @@ Mapfile::print_discarded_sections(const Input_objects* input_objects) ++p) { Relobj* relobj = *p; + // Lock the object so we can read from it. This is only called + // single-threaded from Layout_task_runner, so it is OK to lock. + // Unfortunately we have no way to pass in a Task token. + const Task* dummy_task = reinterpret_cast(-1); + Task_lock_obj tl(dummy_task, relobj); + unsigned int shnum = relobj->shnum(); for (unsigned int i = 0; i < shnum; ++i) { @@ -381,7 +392,7 @@ Mapfile::print_output_section(const Output_section* os) char sizebuf[50]; snprintf(sizebuf, sizeof sizebuf, "0x%llx", - static_cast(os->data_size())); + static_cast(os->current_data_size())); fprintf(this->map_file_, "0x%0*llx %10s", parameters->target().get_size() / 4, @@ -392,6 +403,9 @@ Mapfile::print_output_section(const Output_section* os) parameters->target().get_size() / 4, static_cast(os->load_address())); + if (os->requires_postprocessing()) + fprintf(this->map_file_, " (before compression)"); + putc('\n', this->map_file_); }