1 // parameters.h -- general parameters for a link using gold -*- C++ -*-
3 // Copyright 2006, 2007 Free Software Foundation, Inc.
4 // Written by Ian Lance Taylor <iant@google.com>.
6 // This file is part of gold.
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 3 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 // MA 02110-1301, USA.
23 #ifndef GOLD_PARAMETERS_H
24 #define GOLD_PARAMETERS_H
29 class General_options;
31 // Here we define the Parameters class which simply holds simple
32 // general parameters which apply to the entire link. We use a global
33 // variable for this. This is in contrast to the General_options
34 // class, which holds the complete state of position independent
35 // command line options. The hope is that Parameters will stay fairly
36 // simple, so that if this turns into a library it will be clear how
37 // these parameters should be set.
42 Parameters(const General_options*);
44 // Whether we are generating a regular executable.
46 output_is_executable() const
47 { return this->output_file_type_ == OUTPUT_EXECUTABLE; }
49 // Whether we are generating a shared library.
51 output_is_shared() const
52 { return this->output_file_type_ == OUTPUT_SHARED; }
54 // Whether we are generating an object file.
56 output_is_object() const
57 { return this->output_file_type_ == OUTPUT_OBJECT; }
59 // The general linker optimization level.
61 optimization_level() const
62 { return this->optimization_level_; }
65 // The types of output files.
68 // Generating executable.
70 // Generating shared library.
72 // Generating object file.
76 // The type of the output file.
77 Output_file_type output_file_type_;
78 // The optimization level.
79 int optimization_level_;
82 // This is a global variable.
83 extern const Parameters* parameters;
85 // Initialize the global variable.
86 extern void initialize_parameters(const General_options*);
88 } // End namespace gold.
90 #endif // !defined(GOLD_PARAMATERS_H)