1 // script-sections.h -- linker script SECTIONS for gold -*- C++ -*-
3 // Copyright 2008 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 // This is for the support of the SECTIONS clause in linker scripts.
25 #ifndef GOLD_SCRIPT_SECTIONS_H
26 #define GOLD_SCRIPT_SECTIONS_H
34 struct Parser_output_section_header;
35 struct Parser_output_section_trailer;
36 struct Input_section_spec;
38 class Sections_element;
39 class Output_section_definition;
46 // Start a SECTIONS clause.
50 // Finish a SECTIONS clause.
54 // Return whether we ever saw a SECTIONS clause. If we did, then
55 // all section layout needs to go through this class.
57 saw_sections_clause() const
58 { return this->saw_sections_clause_; }
60 // Return whether we are currently processing a SECTIONS clause.
62 in_sections_clause() const
63 { return this->in_sections_clause_; }
65 // Start processing entries for an output section.
67 start_output_section(const char* name, size_t namelen,
68 const Parser_output_section_header*);
70 // Finish processing entries for an output section.
72 finish_output_section(const Parser_output_section_trailer*);
74 // Add a data item to the current output section.
76 add_data(int size, bool is_signed, Expression* val);
78 // Add a symbol to be defined.
80 add_symbol_assignment(const char* name, size_t length, Expression* value,
81 bool provide, bool hidden);
84 add_assertion(Expression* check, const char* message, size_t messagelen);
86 // Add a setting for the fill value.
88 add_fill(Expression* val);
90 // Add an input section specification.
92 add_input_section(const Input_section_spec* spec, bool keep);
94 // Print the contents to the FILE. This is for debugging.
99 typedef std::vector<Sections_element*> Sections_elements;
101 // True if we ever saw a SECTIONS clause.
102 bool saw_sections_clause_;
103 // True if we are currently processing a SECTIONS clause.
104 bool in_sections_clause_;
105 // The list of elements in the SECTIONS clause.
106 Sections_elements* sections_elements_;
107 // The current output section, if there is one.
108 Output_section_definition* output_section_;
111 } // End namespace gold.
113 #endif // !defined(GOLD_SCRIPT_SECTIONS_H