* sim/cris/asm/testutils.inc (test_move_cc): Add missing call to
[deliverable/binutils-gdb.git] / gold / readsyms.h
CommitLineData
bae7f79e
ILT
1// readsyms.h -- read input file symbols for gold -*- C++ -*-
2
6cb15b7f
ILT
3// Copyright 2006, 2007 Free Software Foundation, Inc.
4// Written by Ian Lance Taylor <iant@google.com>.
5
6// This file is part of gold.
7
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.
12
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.
17
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.
22
bae7f79e
ILT
23#ifndef GOLD_READSYMS_H
24#define GOLD_READSYMS_H
25
ead1e424
ILT
26#include <vector>
27
bae7f79e
ILT
28#include "workqueue.h"
29#include "object.h"
30
31namespace gold
32{
33
54dc6425
ILT
34class Input_objects;
35class Symbol_table;
ead1e424
ILT
36class Input_group;
37class Archive;
54dc6425 38
bae7f79e
ILT
39// This Task is responsible for reading the symbols from an input
40// file. This also includes reading the relocations so that we can
41// check for any that require a PLT and/or a GOT. After the data has
42// been read, this queues up another task to actually add the symbols
43// to the symbol table. The tasks are separated because the file
44// reading can occur in parallel but adding the symbols must be done
45// in the order of the input files.
46
47class Read_symbols : public Task
48{
49 public:
50 // DIRPATH is the list of directories to search for libraries.
ead1e424
ILT
51 // INPUT is the file to read. INPUT_GROUP is not NULL if we are in
52 // the middle of an input group. THIS_BLOCKER is used to prevent
53 // the associated Add_symbols task from running before the previous
54 // one has completed; it will be NULL for the first task.
55 // NEXT_BLOCKER is used to block the next input file from adding
56 // symbols.
54dc6425 57 Read_symbols(const General_options& options, Input_objects* input_objects,
12e14209 58 Symbol_table* symtab, Layout* layout, const Dirsearch& dirpath,
dbe717ef 59 const Input_argument* input_argument, Input_group* input_group,
14bfc3f5 60 Task_token* this_blocker, Task_token* next_blocker)
a2fb1b05 61 : options_(options), input_objects_(input_objects), symtab_(symtab),
dbe717ef 62 layout_(layout), dirpath_(dirpath), input_argument_(input_argument),
ead1e424
ILT
63 input_group_(input_group), this_blocker_(this_blocker),
64 next_blocker_(next_blocker)
bae7f79e
ILT
65 { }
66
67 ~Read_symbols();
68
69 // The standard Task methods.
70
71 Is_runnable_type
72 is_runnable(Workqueue*);
73
74 Task_locker*
75 locks(Workqueue*);
76
77 void
78 run(Workqueue*);
79
80 private:
ead1e424
ILT
81 // Handle an archive group.
82 void
83 do_group(Workqueue*);
84
bae7f79e 85 const General_options& options_;
54dc6425 86 Input_objects* input_objects_;
14bfc3f5 87 Symbol_table* symtab_;
12e14209 88 Layout* layout_;
bae7f79e 89 const Dirsearch& dirpath_;
dbe717ef 90 const Input_argument* input_argument_;
ead1e424 91 Input_group* input_group_;
bae7f79e
ILT
92 Task_token* this_blocker_;
93 Task_token* next_blocker_;
94};
95
96// This Task handles adding the symbols to the symbol table. These
97// tasks must be run in the same order as the arguments appear on the
98// command line.
99
100class Add_symbols : public Task
101{
102 public:
103 // THIS_BLOCKER is used to prevent this task from running before the
104 // one for the previous input file. NEXT_BLOCKER is used to prevent
105 // the next task from running.
7e1edb90
ILT
106 Add_symbols(Input_objects* input_objects, Symbol_table* symtab,
107 Layout* layout, Object* object,
f6ce93d6
ILT
108 Read_symbols_data* sd, Task_token* this_blocker,
109 Task_token* next_blocker)
7e1edb90
ILT
110 : input_objects_(input_objects), symtab_(symtab), layout_(layout),
111 object_(object), sd_(sd), this_blocker_(this_blocker),
ead1e424 112 next_blocker_(next_blocker)
bae7f79e
ILT
113 { }
114
115 ~Add_symbols();
116
117 // The standard Task methods.
118
119 Is_runnable_type
120 is_runnable(Workqueue*);
121
122 Task_locker*
123 locks(Workqueue*);
124
125 void
126 run(Workqueue*);
127
128private:
a2fb1b05
ILT
129 class Add_symbols_locker;
130
ead1e424 131 Input_objects* input_objects_;
14bfc3f5 132 Symbol_table* symtab_;
12e14209 133 Layout* layout_;
bae7f79e 134 Object* object_;
12e14209 135 Read_symbols_data* sd_;
bae7f79e
ILT
136 Task_token* this_blocker_;
137 Task_token* next_blocker_;
138};
139
ead1e424
ILT
140// This class is used to track the archives in a group.
141
142class Input_group
143{
144 public:
145 typedef std::vector<Archive*> Archives;
146 typedef Archives::const_iterator const_iterator;
147
148 Input_group()
149 : archives_()
150 { }
151
152 // Add an archive to the group.
153 void
154 add_archive(Archive* arch)
155 { this->archives_.push_back(arch); }
156
157 // Loop over the archives in the group.
158
159 const_iterator
160 begin() const
161 { return this->archives_.begin(); }
162
163 const_iterator
164 end() const
165 { return this->archives_.end(); }
166
167 private:
168 Archives archives_;
169};
170
171// This class is used to finish up handling a group. It is just a
172// closure.
173
174class Finish_group : public Task
175{
176 public:
7e1edb90
ILT
177 Finish_group(Input_objects* input_objects, Symbol_table* symtab,
178 Layout* layout, Input_group* input_group,
ead1e424
ILT
179 int saw_undefined, Task_token* this_blocker,
180 Task_token* next_blocker)
7e1edb90 181 : input_objects_(input_objects), symtab_(symtab),
f6ce93d6
ILT
182 layout_(layout), input_group_(input_group),
183 saw_undefined_(saw_undefined), this_blocker_(this_blocker),
184 next_blocker_(next_blocker)
ead1e424
ILT
185 { }
186
187 ~Finish_group();
188
189 // The standard Task methods.
190
191 Is_runnable_type
192 is_runnable(Workqueue*);
193
194 Task_locker*
195 locks(Workqueue*);
196
197 void
198 run(Workqueue*);
199
200 private:
201 Input_objects* input_objects_;
202 Symbol_table* symtab_;
203 Layout* layout_;
204 Input_group* input_group_;
205 int saw_undefined_;
206 Task_token* this_blocker_;
207 Task_token* next_blocker_;
208};
209
bae7f79e
ILT
210} // end namespace gold
211
212#endif // !defined(GOLD_READSYMS_H)
This page took 0.139155 seconds and 4 git commands to generate.