* NEW: Mention pending breakpoint changes and
[deliverable/binutils-gdb.git] / gold / parameters.h
CommitLineData
7e1edb90
ILT
1// parameters.h -- general parameters for a link using gold -*- C++ -*-
2
6cb15b7f
ILT
3// Copyright 2006, 2007 Free Software Foundation, Inc.
4// Written by Ian Lance Taylor <iant@google.com>.
5
6// This file is part of gold.
7
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.
12
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.
17
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.
22
7e1edb90
ILT
23#ifndef GOLD_PARAMETERS_H
24#define GOLD_PARAMETERS_H
25
26namespace gold
27{
28
29class General_options;
30
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.
38
39class Parameters
40{
41 public:
42 Parameters(const General_options*);
43
44 // Whether we are generating a regular executable.
45 bool
46 output_is_executable() const
47 { return this->output_file_type_ == OUTPUT_EXECUTABLE; }
48
49 // Whether we are generating a shared library.
50 bool
51 output_is_shared() const
52 { return this->output_file_type_ == OUTPUT_SHARED; }
53
54 // Whether we are generating an object file.
55 bool
56 output_is_object() const
57 { return this->output_file_type_ == OUTPUT_OBJECT; }
58
9025d29d
ILT
59 // The size of the output file we are generating. This should
60 // return 32 or 64.
61 int
62 get_size() const
63 {
64 gold_assert(this->is_size_and_endian_valid_);
65 return this->size_;
66 }
67
68 // Whether the output is big endian.
69 bool
70 is_big_endian() const
71 {
72 gold_assert(this->is_size_and_endian_valid_);
73 return this->is_big_endian_;
74 }
75
7e1edb90
ILT
76 // The general linker optimization level.
77 int
78 optimization_level() const
79 { return this->optimization_level_; }
80
9025d29d
ILT
81 // Set the size and endianness.
82 void
83 set_size_and_endianness(int size, bool is_big_endian);
84
7e1edb90
ILT
85 private:
86 // The types of output files.
87 enum Output_file_type
88 {
89 // Generating executable.
90 OUTPUT_EXECUTABLE,
91 // Generating shared library.
92 OUTPUT_SHARED,
93 // Generating object file.
94 OUTPUT_OBJECT
95 };
96
97 // The type of the output file.
98 Output_file_type output_file_type_;
9025d29d
ILT
99 // Whether the size_ and is_big_endian_ fields are valid.
100 bool is_size_and_endian_valid_;
101 // The size of the output file--32 or 64.
102 int size_;
103 // Whether the output file is big endian.
104 bool is_big_endian_;
7e1edb90
ILT
105 // The optimization level.
106 int optimization_level_;
107};
108
109// This is a global variable.
110extern const Parameters* parameters;
111
112// Initialize the global variable.
113extern void initialize_parameters(const General_options*);
114
9025d29d
ILT
115// Set the size and endianness of the global parameters variable.
116extern void set_parameters_size_and_endianness(int size, bool is_big_endian);
117
7e1edb90
ILT
118} // End namespace gold.
119
120#endif // !defined(GOLD_PARAMATERS_H)
This page took 0.029026 seconds and 4 git commands to generate.