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