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. | |
29 | Read_symbols(const General_options& options, const Dirsearch& dirpath, | |
30 | const Input_argument& input, Task_token* this_blocker, | |
31 | Task_token* next_blocker) | |
32 | : options_(options), dirpath_(dirpath), input_(input), | |
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_; | |
51 | const Dirsearch& dirpath_; | |
52 | const Input_argument& input_; | |
53 | Task_token* this_blocker_; | |
54 | Task_token* next_blocker_; | |
55 | }; | |
56 | ||
57 | // This Task handles adding the symbols to the symbol table. These | |
58 | // tasks must be run in the same order as the arguments appear on the | |
59 | // command line. | |
60 | ||
61 | class Add_symbols : public Task | |
62 | { | |
63 | public: | |
64 | // THIS_BLOCKER is used to prevent this task from running before the | |
65 | // one for the previous input file. NEXT_BLOCKER is used to prevent | |
66 | // the next task from running. | |
67 | Add_symbols(Object* object, Read_symbols_data sd, Task_token* this_blocker, | |
68 | Task_token* next_blocker) | |
69 | : object_(object), sd_(sd), this_blocker_(this_blocker), | |
70 | next_blocker_(next_blocker) | |
71 | { } | |
72 | ||
73 | ~Add_symbols(); | |
74 | ||
75 | // The standard Task methods. | |
76 | ||
77 | Is_runnable_type | |
78 | is_runnable(Workqueue*); | |
79 | ||
80 | Task_locker* | |
81 | locks(Workqueue*); | |
82 | ||
83 | void | |
84 | run(Workqueue*); | |
85 | ||
86 | private: | |
87 | Object* object_; | |
88 | Read_symbols_data sd_; | |
89 | Task_token* this_blocker_; | |
90 | Task_token* next_blocker_; | |
91 | }; | |
92 | ||
93 | } // end namespace gold | |
94 | ||
95 | #endif // !defined(GOLD_READSYMS_H) |