merge from gcc
[binutils-gdb.git] / gold / readsyms.h
1 // readsyms.h -- read input file symbols for gold -*- C++ -*-
2
3 #ifndef GOLD_READSYMS_H
4 #define GOLD_READSYMS_H
5
6 #include "workqueue.h"
7 #include "object.h"
8
9 namespace gold
10 {
11
12 class Input_objects;
13 class Symbol_table;
14
15 // This Task is responsible for reading the symbols from an input
16 // file. This also includes reading the relocations so that we can
17 // check for any that require a PLT and/or a GOT. After the data has
18 // been read, this queues up another task to actually add the symbols
19 // to the symbol table. The tasks are separated because the file
20 // reading can occur in parallel but adding the symbols must be done
21 // in the order of the input files.
22
23 class Read_symbols : public Task
24 {
25 public:
26 // DIRPATH is the list of directories to search for libraries.
27 // INPUT is the file to read. THIS_BLOCKER is used to prevent the
28 // associated Add_symbols task from running before the previous one
29 // has completed; it will be NULL for the first task. NEXT_BLOCKER
30 // is used to block the next input file from adding symbols.
31 Read_symbols(const General_options& options, Input_objects* input_objects,
32 Symbol_table* symtab, Layout* layout, const Dirsearch& dirpath,
33 const Input_argument& input,
34 Task_token* this_blocker, Task_token* next_blocker)
35 : options_(options), input_objects_(input_objects), symtab_(symtab),
36 layout_(layout), dirpath_(dirpath), input_(input),
37 this_blocker_(this_blocker), next_blocker_(next_blocker)
38 { }
39
40 ~Read_symbols();
41
42 // The standard Task methods.
43
44 Is_runnable_type
45 is_runnable(Workqueue*);
46
47 Task_locker*
48 locks(Workqueue*);
49
50 void
51 run(Workqueue*);
52
53 private:
54 const General_options& options_;
55 Input_objects* input_objects_;
56 Symbol_table* symtab_;
57 Layout* layout_;
58 const Dirsearch& dirpath_;
59 const Input_argument& input_;
60 Task_token* this_blocker_;
61 Task_token* next_blocker_;
62 };
63
64 // This Task handles adding the symbols to the symbol table. These
65 // tasks must be run in the same order as the arguments appear on the
66 // command line.
67
68 class Add_symbols : public Task
69 {
70 public:
71 // THIS_BLOCKER is used to prevent this task from running before the
72 // one for the previous input file. NEXT_BLOCKER is used to prevent
73 // the next task from running.
74 Add_symbols(Symbol_table* symtab, Layout* layout, Object* object,
75 Read_symbols_data* sd, Task_token* this_blocker,
76 Task_token* next_blocker)
77 : symtab_(symtab), layout_(layout), object_(object), sd_(sd),
78 this_blocker_(this_blocker), next_blocker_(next_blocker)
79 { }
80
81 ~Add_symbols();
82
83 // The standard Task methods.
84
85 Is_runnable_type
86 is_runnable(Workqueue*);
87
88 Task_locker*
89 locks(Workqueue*);
90
91 void
92 run(Workqueue*);
93
94 private:
95 class Add_symbols_locker;
96
97 Symbol_table* symtab_;
98 Layout* layout_;
99 Object* object_;
100 Read_symbols_data* sd_;
101 Task_token* this_blocker_;
102 Task_token* next_blocker_;
103 };
104
105 } // end namespace gold
106
107 #endif // !defined(GOLD_READSYMS_H)