gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gold / mapfile.cc
index e053419c092698e283b710d25c15fbf7ae30ef1c..63a8e54a0008d2a650d40afc7cce6ed1a4178b30 100644 (file)
@@ -1,6 +1,6 @@
 // mapfile.cc -- map file generation for gold
 
-// Copyright 2008 Free Software Foundation, Inc.
+// Copyright (C) 2008-2020 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -105,8 +105,7 @@ Mapfile::advance_to_column(size_t from, size_t to)
 // Report about including a member from an archive.
 
 void
-Mapfile::report_include_archive_member(const Archive* archive,
-                                      const std::string& member_name,
+Mapfile::report_include_archive_member(const std::string& member_name,
                                       const Symbol* sym, const char* why)
 {
   // We print a header before the list of archive members, mainly for
@@ -118,13 +117,9 @@ Mapfile::report_include_archive_member(const Archive* archive,
       this->printed_archive_header_ = true;
     }
 
-  fprintf(this->map_file_, "%s(%s)", archive->file().filename().c_str(),
-         member_name.c_str());
+  fprintf(this->map_file_, "%s", member_name.c_str());
 
-  size_t len = (archive->file().filename().length()
-               + member_name.length()
-               + 2);
-  this->advance_to_column(len, 30);
+  this->advance_to_column(member_name.length(), 30);
 
   if (sym == NULL)
     fprintf(this->map_file_, "%s", why);
@@ -207,7 +202,7 @@ Mapfile::print_memory_map_header()
 template<int size, bool big_endian>
 void
 Mapfile::print_input_section_symbols(
-    const Sized_relobj<size, big_endian>* relobj,
+    const Sized_relobj_file<size, big_endian>* relobj,
     unsigned int shndx)
 {
   unsigned int symcount = relobj->symbol_count();
@@ -256,17 +251,18 @@ Mapfile::print_input_section(Relobj* relobj, unsigned int shndx)
     }
   else
     {
-      section_offset_type offset;
-      os = relobj->output_section(shndx, &offset);
-      if (offset == -1)
-       addr = ~0ULL;
-      else
-       addr = os->address() + offset;
+      os = relobj->output_section(shndx);
+      addr = relobj->output_section_offset(shndx);
+      if (addr != -1ULL)
+       addr += os->address();
     }
 
   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<unsigned long long>(relobj->section_size(shndx)));
+          static_cast<unsigned long long>(size));
 
   fprintf(this->map_file_, "0x%0*llx %10s %s\n",
          parameters->target().get_size() / 4,
@@ -280,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<Sized_relobj<32, false>*>(relobj);
+           const Sized_relobj_file<32, false>* sized_relobj =
+             static_cast<Sized_relobj_file<32, false>*>(relobj);
            this->print_input_section_symbols(sized_relobj, shndx);
          }
          break;
@@ -289,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<Sized_relobj<32, true>*>(relobj);
+           const Sized_relobj_file<32, true>* sized_relobj =
+             static_cast<Sized_relobj_file<32, true>*>(relobj);
            this->print_input_section_symbols(sized_relobj, shndx);
          }
          break;
@@ -298,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<Sized_relobj<64, false>*>(relobj);
+           const Sized_relobj_file<64, false>* sized_relobj =
+             static_cast<Sized_relobj_file<64, false>*>(relobj);
            this->print_input_section_symbols(sized_relobj, shndx);
          }
          break;
@@ -307,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<Sized_relobj<64, true>*>(relobj);
+           const Sized_relobj_file<64, true>* sized_relobj =
+             static_cast<Sized_relobj_file<64, true>*>(relobj);
            this->print_input_section_symbols(sized_relobj, shndx);
          }
          break;
@@ -335,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<unsigned long long>(od->data_size()));
+          static_cast<unsigned long long>(od->current_data_size()));
 
   fprintf(this->map_file_, "0x%0*llx %10s\n",
          parameters->target().get_size() / 4,
-         static_cast<unsigned long long>(od->address()),
+         (od->is_address_valid()
+          ? static_cast<unsigned long long>(od->address())
+          : 0),
          sizebuf);
 }
 
@@ -354,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<const Task*>(-1);
+      Task_lock_obj<Object> tl(dummy_task, relobj);
+
       unsigned int shnum = relobj->shnum();
       for (unsigned int i = 0; i < shnum; ++i)
        {
@@ -388,7 +392,7 @@ Mapfile::print_output_section(const Output_section* os)
 
   char sizebuf[50];
   snprintf(sizebuf, sizeof sizebuf, "0x%llx",
-          static_cast<unsigned long long>(os->data_size()));
+          static_cast<unsigned long long>(os->current_data_size()));
 
   fprintf(this->map_file_, "0x%0*llx %10s",
          parameters->target().get_size() / 4,
@@ -399,6 +403,9 @@ Mapfile::print_output_section(const Output_section* os)
            parameters->target().get_size() / 4,
            static_cast<unsigned long long>(os->load_address()));
 
+  if (os->requires_postprocessing())
+    fprintf(this->map_file_, " (before compression)");
+
   putc('\n', this->map_file_);
 }
 
This page took 0.026023 seconds and 4 git commands to generate.