From e02a4046e0617f3e2c1b811a1888db3fa998dfa4 Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Tue, 16 Dec 2014 14:57:17 -0800 Subject: Fix internal error in gold when -Map and --compress-debug-sections are used together. gold/ * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes. (Mapfile::print_output_data): Use current_data_size() to avoid assert for sections requiring postprocessing; if address is not valid, print 0. (Mapfile::print_output_section): Use current_data_size(); print note that addresses and sizes are before compression. --- gold/ChangeLog | 9 +++++++++ gold/mapfile.cc | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'gold') diff --git a/gold/ChangeLog b/gold/ChangeLog index 8f56043..9edf043 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,12 @@ +2014-12-16 Cary Coutant + + * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes. + (Mapfile::print_output_data): Use current_data_size() to avoid + assert for sections requiring postprocessing; if address is not valid, + print 0. + (Mapfile::print_output_section): Use current_data_size(); print note + that addresses and sizes are before compression. + 2014-12-14 H.J. Lu * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub): diff --git a/gold/mapfile.cc b/gold/mapfile.cc index dc995e9..c6d7ed2 100644 --- a/gold/mapfile.cc +++ b/gold/mapfile.cc @@ -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, @@ -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); } @@ -387,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, @@ -398,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_); } -- cgit v1.1