Add global parameters.
[deliverable/binutils-gdb.git] / gold / parameters.h
1 // parameters.h -- general parameters for a link using gold -*- C++ -*-
2
3 #ifndef GOLD_PARAMETERS_H
4 #define GOLD_PARAMETERS_H
5
6 namespace gold
7 {
8
9 class General_options;
10
11 // Here we define the Parameters class which simply holds simple
12 // general parameters which apply to the entire link. We use a global
13 // variable for this. This is in contrast to the General_options
14 // class, which holds the complete state of position independent
15 // command line options. The hope is that Parameters will stay fairly
16 // simple, so that if this turns into a library it will be clear how
17 // these parameters should be set.
18
19 class Parameters
20 {
21 public:
22 Parameters(const General_options*);
23
24 // Whether we are generating a regular executable.
25 bool
26 output_is_executable() const
27 { return this->output_file_type_ == OUTPUT_EXECUTABLE; }
28
29 // Whether we are generating a shared library.
30 bool
31 output_is_shared() const
32 { return this->output_file_type_ == OUTPUT_SHARED; }
33
34 // Whether we are generating an object file.
35 bool
36 output_is_object() const
37 { return this->output_file_type_ == OUTPUT_OBJECT; }
38
39 // The general linker optimization level.
40 int
41 optimization_level() const
42 { return this->optimization_level_; }
43
44 private:
45 // The types of output files.
46 enum Output_file_type
47 {
48 // Generating executable.
49 OUTPUT_EXECUTABLE,
50 // Generating shared library.
51 OUTPUT_SHARED,
52 // Generating object file.
53 OUTPUT_OBJECT
54 };
55
56 // The type of the output file.
57 Output_file_type output_file_type_;
58 // The optimization level.
59 int optimization_level_;
60 };
61
62 // This is a global variable.
63 extern const Parameters* parameters;
64
65 // Initialize the global variable.
66 extern void initialize_parameters(const General_options*);
67
68 } // End namespace gold.
69
70 #endif // !defined(GOLD_PARAMATERS_H)
This page took 0.062593 seconds and 5 git commands to generate.