Don't include options.h in fileread.h. Remove General_options
[deliverable/binutils-gdb.git] / gold / script-c.h
CommitLineData
dbe717ef
ILT
1/* script-c.h -- C interface for linker scripts in gold. */
2
e5756efb 3/* Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
6cb15b7f
ILT
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
dbe717ef
ILT
23/* This file exists so that both the bison parser and script.cc can
24 include it, so that they can communicate back and forth. */
25
26#ifndef GOLD_SCRIPT_C_H
27#define GOLD_SCRIPT_C_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
e5756efb
ILT
33/* A string value for the bison parser. */
34
35struct Parser_string
36{
37 const char* value;
38 size_t length;
39};
40
41/* The expression functions deal with pointers to Expression objects.
42 Since the bison parser generates C code, this is a hack to keep the
43 C++ code type safe. This hacks assumes that all pointers look
44 alike. */
45
46#ifdef __cplusplus
47namespace gold
48{
49class Expression;
50}
51typedef gold::Expression* Expression_ptr;
52#else
53typedef void* Expression_ptr;
54#endif
55
56/* The bison parser definitions. */
57
dbe717ef
ILT
58#include "yyscript.h"
59
60/* The bison parser function. */
61
62extern int
63yyparse(void* closure);
64
65/* Called by the bison parser skeleton to return the next token. */
66
67extern int
68yylex(YYSTYPE*, void* closure);
69
70/* Called by the bison parser skeleton to report an error. */
71
72extern void
73yyerror(void* closure, const char*);
74
75/* Called by the bison parser to add a file to the link. */
76
77extern void
e5756efb 78script_add_file(void* closure, const char*, size_t);
dbe717ef
ILT
79
80/* Called by the bison parser to start and stop a group. */
81
82extern void
83script_start_group(void* closure);
84extern void
85script_end_group(void* closure);
86
87/* Called by the bison parser to start and end an AS_NEEDED list. */
88
89extern void
90script_start_as_needed(void* closure);
91extern void
92script_end_as_needed(void* closure);
93
d391083d
ILT
94/* Called by the bison parser to set the entry symbol. */
95
96extern void
e5756efb 97script_set_entry(void* closure, const char*, size_t);
d391083d 98
195e7dc6 99/* Called by the bison parser to parse an OPTION. */
e5756efb
ILT
100
101extern void
102script_parse_option(void* closure, const char*, size_t);
103
104/* Called by the bison parser to push the lexer into expression
105 mode. */
106
107extern void
108script_push_lex_into_expression_mode(void* closure);
109
09124467
ILT
110/* Called by the bison parser to push the lexer into version
111 mode. */
112
113extern void
114script_push_lex_into_version_mode(void* closure);
115
e5756efb
ILT
116/* Called by the bison parser to pop the lexer mode. */
117
118extern void
119script_pop_lex_mode(void* closure);
120
121/* Called by the bison parser to set a symbol to a value. PROVIDE is
122 non-zero if the symbol should be provided--only defined if there is
123 an undefined reference. HIDDEN is non-zero if the symbol should be
124 hidden. */
125
195e7dc6 126extern void
e5756efb
ILT
127script_set_symbol(void* closure, const char*, size_t, Expression_ptr,
128 int provide, int hidden);
129
130/* Called by the bison parser for expressions. */
131
132extern Expression_ptr
133script_exp_unary_minus(Expression_ptr);
134extern Expression_ptr
135script_exp_unary_logical_not(Expression_ptr);
136extern Expression_ptr
137script_exp_unary_bitwise_not(Expression_ptr);
138extern Expression_ptr
139script_exp_binary_mult(Expression_ptr, Expression_ptr);
140extern Expression_ptr
141script_exp_binary_div(Expression_ptr, Expression_ptr);
142extern Expression_ptr
143script_exp_binary_mod(Expression_ptr, Expression_ptr);
144extern Expression_ptr
145script_exp_binary_add(Expression_ptr, Expression_ptr);
146extern Expression_ptr
147script_exp_binary_sub(Expression_ptr, Expression_ptr);
148extern Expression_ptr
149script_exp_binary_lshift(Expression_ptr, Expression_ptr);
150extern Expression_ptr
151script_exp_binary_rshift(Expression_ptr, Expression_ptr);
152extern Expression_ptr
153script_exp_binary_eq(Expression_ptr, Expression_ptr);
154extern Expression_ptr
155script_exp_binary_ne(Expression_ptr, Expression_ptr);
156extern Expression_ptr
157script_exp_binary_le(Expression_ptr, Expression_ptr);
158extern Expression_ptr
159script_exp_binary_ge(Expression_ptr, Expression_ptr);
160extern Expression_ptr
161script_exp_binary_lt(Expression_ptr, Expression_ptr);
162extern Expression_ptr
163script_exp_binary_gt(Expression_ptr, Expression_ptr);
164extern Expression_ptr
165script_exp_binary_bitwise_and(Expression_ptr, Expression_ptr);
166extern Expression_ptr
167script_exp_binary_bitwise_xor(Expression_ptr, Expression_ptr);
168extern Expression_ptr
169script_exp_binary_bitwise_or(Expression_ptr, Expression_ptr);
170extern Expression_ptr
171script_exp_binary_logical_and(Expression_ptr, Expression_ptr);
172extern Expression_ptr
173script_exp_binary_logical_or(Expression_ptr, Expression_ptr);
174extern Expression_ptr
175script_exp_trinary_cond(Expression_ptr, Expression_ptr, Expression_ptr);
176extern Expression_ptr
177script_exp_integer(uint64_t);
178extern Expression_ptr
179script_exp_string(const char*, size_t);
180extern Expression_ptr
181script_exp_function_max(Expression_ptr, Expression_ptr);
182extern Expression_ptr
183script_exp_function_min(Expression_ptr, Expression_ptr);
184extern Expression_ptr
185script_exp_function_defined(const char*, size_t);
186extern Expression_ptr
187script_exp_function_sizeof_headers();
188extern Expression_ptr
189script_exp_function_alignof(const char*, size_t);
190extern Expression_ptr
191script_exp_function_sizeof(const char*, size_t);
192extern Expression_ptr
193script_exp_function_addr(const char*, size_t);
194extern Expression_ptr
195script_exp_function_loadaddr(const char*, size_t);
196extern Expression_ptr
197script_exp_function_origin(const char*, size_t);
198extern Expression_ptr
199script_exp_function_length(const char*, size_t);
200extern Expression_ptr
201script_exp_function_constant(const char*, size_t);
202extern Expression_ptr
203script_exp_function_absolute(Expression_ptr);
204extern Expression_ptr
205script_exp_function_align(Expression_ptr, Expression_ptr);
206extern Expression_ptr
207script_exp_function_data_segment_align(Expression_ptr, Expression_ptr);
208extern Expression_ptr
209script_exp_function_data_segment_relro_end(Expression_ptr, Expression_ptr);
210extern Expression_ptr
211script_exp_function_data_segment_end(Expression_ptr);
212extern Expression_ptr
213script_exp_function_segment_start(const char*, size_t, Expression_ptr);
214extern Expression_ptr
215script_exp_function_assert(Expression_ptr, const char*, size_t);
195e7dc6 216
09124467
ILT
217struct Version_dependency_list;
218struct Version_expression_list;
219struct Version_tree;
220
221extern void
222script_register_vers_node(void* closure,
223 const char* tag,
224 int taglen,
225 struct Version_tree *,
226 struct Version_dependency_list *);
227
228extern struct Version_dependency_list *
229script_add_vers_depend(void* closure,
230 struct Version_dependency_list *existing_dependencies,
231 const char *depend_to_add, int deplen);
232
233extern struct Version_expression_list *
234script_new_vers_pattern(void* closure,
235 struct Version_expression_list *,
236 const char *, int);
237
238extern struct Version_tree *
239script_new_vers_node(void* closure,
240 struct Version_expression_list *global,
241 struct Version_expression_list *local);
242
243extern void
244version_script_push_lang(void* closure, const char* lang, int langlen);
245
246extern void
247version_script_pop_lang(void* closure);
248
dbe717ef
ILT
249#ifdef __cplusplus
250}
251#endif
252
253#endif /* !defined(GOLD_SCRIPT_C_H) */
This page took 0.074815 seconds and 4 git commands to generate.