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