Update copyright year in --version messages.
[binutils.git] / gold / mapfile.h
blobab55c38ea4f738ffbae26687d7f77ff07a4faf57
1 // mapfile.h -- map file generation for gold -*- C++ -*-
3 // Copyright 2008 Free Software Foundation, Inc.
4 // Written by Ian Lance Taylor <iant@google.com>.
6 // This file is part of gold.
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 3 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 // MA 02110-1301, USA.
23 #ifndef GOLD_MAP_H
24 #define GOLD_MAP_H
26 #include <cstdio>
27 #include <string>
29 namespace gold
32 class Archive;
33 class Symbol;
34 class Relobj;
35 template<int size, bool big_endian>
36 class Sized_relobj;
37 class Output_section;
38 class Output_data;
40 // This class manages map file output.
42 class Mapfile
44 public:
45 Mapfile();
47 ~Mapfile();
49 // Open the map file. Return whether the open succeed.
50 bool
51 open(const char* map_filename);
53 // Close the map file.
54 void
55 close();
57 // Report that we are including a member from an archive. This is
58 // called by the archive reading code.
59 void
60 report_include_archive_member(const std::string& member_name,
61 const Symbol* sym, const char* why);
63 // Report allocating a common symbol.
64 void
65 report_allocate_common(const Symbol*, uint64_t symsize);
67 // Print discarded input sections.
68 void
69 print_discarded_sections(const Input_objects*);
71 // Print an output section.
72 void
73 print_output_section(const Output_section*);
75 // Print an input section.
76 void
77 print_input_section(Relobj*, unsigned int shndx);
79 // Print an Output_data.
80 void
81 print_output_data(const Output_data*, const char* name);
83 private:
84 // The space we allow for a section name.
85 static const size_t section_name_map_length;
87 // Advance to a column.
88 void
89 advance_to_column(size_t from, size_t to);
91 // Print the memory map header.
92 void
93 print_memory_map_header();
95 // Print symbols for an input section.
96 template<int size, bool big_endian>
97 void
98 print_input_section_symbols(const Sized_relobj<size, big_endian>*,
99 unsigned int shndx);
101 // Map file to write to.
102 FILE* map_file_;
103 // Whether we have printed the archive member header.
104 bool printed_archive_header_;
105 // Whether we have printed the allocated common header.
106 bool printed_common_header_;
107 // Whether we have printed the memory map header.
108 bool printed_memory_map_header_;
111 } // End namespace gold.
113 #endif // !defined(GOLD_MAP_H)