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