2006-09-08 H.J. Lu <hongjiu.lu@intel.com>
[binutils.git] / gold / readsyms.h
blobf01cf6108e262b0015fc0acb5fbbb552745800d9
1 // readsyms.h -- read input file symbols for gold -*- C++ -*-
3 #ifndef GOLD_READSYMS_H
4 #define GOLD_READSYMS_H
6 #include "targetsize.h"
7 #include "workqueue.h"
8 #include "object.h"
10 namespace gold
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.
21 class Read_symbols : public Task
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, 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),
33 this_blocker_(this_blocker), next_blocker_(next_blocker)
34 { }
36 ~Read_symbols();
38 // The standard Task methods.
40 Is_runnable_type
41 is_runnable(Workqueue*);
43 Task_locker*
44 locks(Workqueue*);
46 void
47 run(Workqueue*);
49 private:
50 const General_options& options_;
51 Symbol_table* symtab_;
52 const Dirsearch& dirpath_;
53 const Input_argument& input_;
54 Task_token* this_blocker_;
55 Task_token* next_blocker_;
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.
62 class Add_symbols : public Task
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.
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),
71 next_blocker_(next_blocker)
72 { }
74 ~Add_symbols();
76 // The standard Task methods.
78 Is_runnable_type
79 is_runnable(Workqueue*);
81 Task_locker*
82 locks(Workqueue*);
84 void
85 run(Workqueue*);
87 private:
88 Symbol_table* symtab_;
89 Object* object_;
90 Read_symbols_data sd_;
91 Task_token* this_blocker_;
92 Task_token* next_blocker_;
95 } // end namespace gold
97 #endif // !defined(GOLD_READSYMS_H)