]>
Commit | Line | Data |
---|---|---|
8e5a525c | 1 | /* A YACC grammar to parse a superset of the AT&T linker scripting language. |
fd67aa11 | 2 | Copyright (C) 1991-2024 Free Software Foundation, Inc. |
252b5132 RH |
3 | Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com). |
4 | ||
f96b4a7b | 5 | This file is part of the GNU Binutils. |
252b5132 | 6 | |
3ec57632 NC |
7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | |
f96b4a7b | 9 | the Free Software Foundation; either version 3 of the License, or |
3ec57632 | 10 | (at your option) any later version. |
252b5132 | 11 | |
3ec57632 NC |
12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
252b5132 | 16 | |
3ec57632 NC |
17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | |
f96b4a7b NC |
19 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
20 | MA 02110-1301, USA. */ | |
252b5132 RH |
21 | |
22 | %{ | |
23 | /* | |
24 | ||
25 | */ | |
26 | ||
27 | #define DONTDECLARE_MALLOC | |
28 | ||
252b5132 | 29 | #include "sysdep.h" |
b5c37946 | 30 | #include "libiberty.h" |
3db64b00 | 31 | #include "bfd.h" |
252b5132 | 32 | #include "bfdlink.h" |
1ff6de03 | 33 | #include "ctf-api.h" |
d038301c | 34 | #include "ld.h" |
252b5132 RH |
35 | #include "ldexp.h" |
36 | #include "ldver.h" | |
37 | #include "ldlang.h" | |
252b5132 | 38 | #include "ldfile.h" |
b71e2778 | 39 | #include "ldemul.h" |
252b5132 RH |
40 | #include "ldmisc.h" |
41 | #include "ldmain.h" | |
42 | #include "mri.h" | |
43 | #include "ldctor.h" | |
44 | #include "ldlex.h" | |
45 | ||
46 | #ifndef YYDEBUG | |
47 | #define YYDEBUG 1 | |
48 | #endif | |
49 | ||
50 | static enum section_type sectype; | |
c212f39d | 51 | static etree_type *sectype_value; |
279e75dc | 52 | static lang_memory_region_type *region; |
252b5132 | 53 | |
f38a2680 | 54 | static bool ldgram_had_keep = false; |
2b94abd4 | 55 | static char *ldgram_vers_current_lang = NULL; |
252b5132 RH |
56 | |
57 | #define ERROR_NAME_MAX 20 | |
58 | static char *error_names[ERROR_NAME_MAX]; | |
59 | static int error_index; | |
60 | #define PUSH_ERROR(x) if (error_index < ERROR_NAME_MAX) error_names[error_index] = x; error_index++; | |
61 | #define POP_ERROR() error_index--; | |
b5c37946 SJ |
62 | |
63 | static void yyerror (const char *); | |
252b5132 RH |
64 | %} |
65 | %union { | |
66 | bfd_vma integer; | |
2c382fb6 AM |
67 | struct big_int |
68 | { | |
69 | bfd_vma integer; | |
70 | char *str; | |
71 | } bigint; | |
72 | fill_type *fill; | |
252b5132 RH |
73 | char *name; |
74 | const char *cname; | |
75 | struct wildcard_spec wildcard; | |
b6bf44ba | 76 | struct wildcard_list *wildcard_list; |
18625d54 | 77 | struct name_list *name_list; |
ae17ab41 CM |
78 | struct flag_info_list *flag_info_list; |
79 | struct flag_info *flag_info; | |
252b5132 RH |
80 | int token; |
81 | union etree_union *etree; | |
82 | struct phdr_info | |
83 | { | |
f38a2680 AM |
84 | bool filehdr; |
85 | bool phdrs; | |
252b5132 RH |
86 | union etree_union *at; |
87 | union etree_union *flags; | |
88 | } phdr; | |
89 | struct lang_nocrossref *nocrossref; | |
90 | struct lang_output_section_phdr_list *section_phdr; | |
91 | struct bfd_elf_version_deps *deflist; | |
92 | struct bfd_elf_version_expr *versyms; | |
93 | struct bfd_elf_version_tree *versnode; | |
94 | } | |
95 | ||
96 | %type <etree> exp opt_exp_with_type mustbe_exp opt_at phdr_type phdr_val | |
bbf115d3 | 97 | %type <etree> opt_exp_without_type opt_subalign opt_align |
2c382fb6 | 98 | %type <fill> fill_opt fill_exp |
18625d54 | 99 | %type <name_list> exclude_name_list |
2b94abd4 | 100 | %type <wildcard_list> section_name_list |
ae17ab41 CM |
101 | %type <flag_info_list> sect_flag_list |
102 | %type <flag_info> sect_flags | |
553dd76c | 103 | %type <name> memspec_opt memspec_at_opt paren_script_name casesymlist |
252b5132 | 104 | %type <cname> wildcard_name |
85921e9a | 105 | %type <wildcard> section_name_spec filename_spec wildcard_maybe_exclude wildcard_maybe_reverse |
d038301c | 106 | %token <bigint> INT |
252b5132 RH |
107 | %token <name> NAME LNAME |
108 | %type <integer> length | |
109 | %type <phdr> phdr_qualifiers | |
110 | %type <nocrossref> nocrossref_list | |
111 | %type <section_phdr> phdr_opt | |
112 | %type <integer> opt_nocrossrefs | |
113 | ||
b5c37946 | 114 | %right <token> PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ XOREQ |
252b5132 RH |
115 | %right <token> '?' ':' |
116 | %left <token> OROR | |
117 | %left <token> ANDAND | |
118 | %left <token> '|' | |
119 | %left <token> '^' | |
120 | %left <token> '&' | |
121 | %left <token> EQ NE | |
122 | %left <token> '<' '>' LE GE | |
123 | %left <token> LSHIFT RSHIFT | |
124 | ||
125 | %left <token> '+' '-' | |
126 | %left <token> '*' '/' '%' | |
127 | ||
128 | %right UNARY | |
d038301c | 129 | %token END |
252b5132 | 130 | %left <token> '(' |
a4d5aec7 | 131 | %token <token> ALIGN_K BLOCK BIND QUAD SQUAD LONG SHORT BYTE ASCIZ |
2d5783fa | 132 | %token SECTIONS PHDRS INSERT_K AFTER BEFORE LINKER_VERSION |
53d25da6 | 133 | %token DATA_SEGMENT_ALIGN DATA_SEGMENT_RELRO_END DATA_SEGMENT_END |
eda680f8 | 134 | %token SORT_BY_NAME SORT_BY_ALIGNMENT SORT_NONE |
85921e9a | 135 | %token SORT_BY_INIT_PRIORITY REVERSE |
252b5132 RH |
136 | %token '{' '}' |
137 | %token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH | |
7bdf4127 | 138 | %token INHIBIT_COMMON_ALLOCATION FORCE_GROUP_ALLOCATION |
ba916c8a | 139 | %token SEGMENT_START |
252b5132 | 140 | %token INCLUDE |
ed9ef263 | 141 | %token MEMORY |
4a93e180 | 142 | %token REGION_ALIAS |
01554a74 | 143 | %token LD_FEATURE |
252b5132 | 144 | %token NOLOAD DSECT COPY INFO OVERLAY |
6b86da53 | 145 | %token READONLY |
c212f39d | 146 | %token TYPE |
ed9ef263 | 147 | %token DEFINED TARGET_K SEARCH_DIR MAP ENTRY |
252b5132 | 148 | %token <integer> NEXT |
5d41b3ef | 149 | %token SIZEOF ALIGNOF ADDR LOADADDR MAX_K MIN_K |
cdf96953 | 150 | %token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS NOCROSSREFS_TO |
252b5132 RH |
151 | %token ORIGIN FILL |
152 | %token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS | |
eb8476a6 | 153 | %token ALIGNMOD AT SUBALIGN HIDDEN PROVIDE PROVIDE_HIDDEN AS_NEEDED |
1eec346e | 154 | %type <token> assign_op atype attributes_opt sect_constraint opt_align_with_input |
252b5132 RH |
155 | %type <name> filename |
156 | %token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD ASSERT_K | |
2e53f7d6 | 157 | %token LOG2CEIL FORMAT PUBLIC DEFSYMEND BASE ALIAS TRUNCATE REL |
252b5132 RH |
158 | %token INPUT_SCRIPT INPUT_MRI_SCRIPT INPUT_DEFSYM CASE EXTERN START |
159 | %token <name> VERS_TAG VERS_IDENTIFIER | |
6e8376fa | 160 | %token GLOBAL LOCAL VERSIONK INPUT_VERSION_SCRIPT INPUT_SECTION_ORDERING_SCRIPT |
1eec346e | 161 | %token KEEP ONLY_IF_RO ONLY_IF_RW SPECIAL INPUT_SECTION_FLAGS ALIGN_WITH_INPUT |
252b5132 | 162 | %token EXCLUDE_FILE |
24718e3b | 163 | %token CONSTANT |
252b5132 RH |
164 | %type <versyms> vers_defns |
165 | %type <versnode> vers_tag | |
166 | %type <deflist> verdep | |
55255dae | 167 | %token INPUT_DYNAMIC_LIST |
252b5132 RH |
168 | |
169 | %% | |
170 | ||
d038301c | 171 | file: |
252b5132 RH |
172 | INPUT_SCRIPT script_file |
173 | | INPUT_MRI_SCRIPT mri_script_file | |
174 | | INPUT_VERSION_SCRIPT version_script_file | |
6e8376fa | 175 | | INPUT_SECTION_ORDERING_SCRIPT section_ordering_script_file |
55255dae | 176 | | INPUT_DYNAMIC_LIST dynamic_list_file |
252b5132 RH |
177 | | INPUT_DEFSYM defsym_expr |
178 | ; | |
179 | ||
180 | ||
181 | filename: NAME; | |
182 | ||
183 | ||
184 | defsym_expr: | |
fb6c220e AM |
185 | { ldlex_expression(); } |
186 | assignment | |
187 | { ldlex_popstate(); } | |
944cd72c | 188 | ; |
252b5132 | 189 | |
d038301c | 190 | /* SYNTAX WITHIN AN MRI SCRIPT FILE */ |
252b5132 RH |
191 | mri_script_file: |
192 | { | |
193 | ldlex_mri_script (); | |
194 | PUSH_ERROR (_("MRI style script")); | |
195 | } | |
196 | mri_script_lines | |
197 | { | |
198 | ldlex_popstate (); | |
199 | mri_draw_tree (); | |
200 | POP_ERROR (); | |
201 | } | |
202 | ; | |
203 | ||
204 | mri_script_lines: | |
205 | mri_script_lines mri_script_command NEWLINE | |
6c19b93b | 206 | | |
252b5132 RH |
207 | ; |
208 | ||
209 | mri_script_command: | |
d038301c | 210 | CHIP exp |
252b5132 | 211 | | CHIP exp ',' exp |
6c19b93b | 212 | | NAME { |
df5f2391 | 213 | einfo(_("%F%P: unrecognised keyword in MRI style script '%s'\n"),$1); |
252b5132 | 214 | } |
6c19b93b | 215 | | LIST { |
252b5132 RH |
216 | config.map_filename = "-"; |
217 | } | |
6c19b93b AM |
218 | | ORDER ordernamelist |
219 | | ENDWORD | |
220 | | PUBLIC NAME '=' exp | |
221 | { mri_public($2, $4); } | |
222 | | PUBLIC NAME ',' exp | |
223 | { mri_public($2, $4); } | |
224 | | PUBLIC NAME exp | |
225 | { mri_public($2, $3); } | |
226 | | FORMAT NAME | |
252b5132 RH |
227 | { mri_format($2); } |
228 | | SECT NAME ',' exp | |
229 | { mri_output_section($2, $4);} | |
230 | | SECT NAME exp | |
231 | { mri_output_section($2, $3);} | |
232 | | SECT NAME '=' exp | |
233 | { mri_output_section($2, $4);} | |
234 | | ALIGN_K NAME '=' exp | |
235 | { mri_align($2,$4); } | |
236 | | ALIGN_K NAME ',' exp | |
237 | { mri_align($2,$4); } | |
238 | | ALIGNMOD NAME '=' exp | |
239 | { mri_alignmod($2,$4); } | |
240 | | ALIGNMOD NAME ',' exp | |
241 | { mri_alignmod($2,$4); } | |
242 | | ABSOLUTE mri_abs_name_list | |
243 | | LOAD mri_load_name_list | |
6c19b93b | 244 | | NAMEWORD NAME |
d038301c | 245 | { mri_name($2); } |
252b5132 RH |
246 | | ALIAS NAME ',' NAME |
247 | { mri_alias($2,$4,0);} | |
248 | | ALIAS NAME ',' INT | |
2c382fb6 | 249 | { mri_alias ($2, 0, (int) $4.integer); } |
6c19b93b | 250 | | BASE exp |
252b5132 | 251 | { mri_base($2); } |
2c382fb6 AM |
252 | | TRUNCATE INT |
253 | { mri_truncate ((unsigned int) $2.integer); } | |
252b5132 RH |
254 | | CASE casesymlist |
255 | | EXTERN extern_name_list | |
256 | | INCLUDE filename | |
3bb17dfb | 257 | { ldfile_open_command_file ($2); } |
b47c4208 | 258 | mri_script_lines END |
252b5132 | 259 | | START NAME |
f38a2680 | 260 | { lang_add_entry ($2, false); } |
6c19b93b | 261 | | |
252b5132 RH |
262 | ; |
263 | ||
264 | ordernamelist: | |
6c19b93b AM |
265 | ordernamelist ',' NAME { mri_order($3); } |
266 | | ordernamelist NAME { mri_order($2); } | |
267 | | | |
252b5132 RH |
268 | ; |
269 | ||
270 | mri_load_name_list: | |
271 | NAME | |
272 | { mri_load($1); } | |
273 | | mri_load_name_list ',' NAME { mri_load($3); } | |
274 | ; | |
275 | ||
276 | mri_abs_name_list: | |
6c19b93b AM |
277 | NAME |
278 | { mri_only_load($1); } | |
252b5132 | 279 | | mri_abs_name_list ',' NAME |
6c19b93b | 280 | { mri_only_load($3); } |
252b5132 RH |
281 | ; |
282 | ||
283 | casesymlist: | |
284 | /* empty */ { $$ = NULL; } | |
285 | | NAME | |
286 | | casesymlist ',' NAME | |
287 | ; | |
288 | ||
289 | extern_name_list: | |
34a7af0f | 290 | NAME |
f38a2680 | 291 | { ldlang_add_undef ($1, false); } |
34a7af0f | 292 | | extern_name_list NAME |
f38a2680 | 293 | { ldlang_add_undef ($2, false); } |
34a7af0f | 294 | | extern_name_list ',' NAME |
f38a2680 | 295 | { ldlang_add_undef ($3, false); } |
252b5132 RH |
296 | ; |
297 | ||
298 | script_file: | |
af29a8ab | 299 | { ldlex_script (); } |
8545d1a9 | 300 | ifile_list |
af29a8ab | 301 | { ldlex_popstate (); } |
6c19b93b | 302 | ; |
252b5132 | 303 | |
252b5132 | 304 | ifile_list: |
8545d1a9 | 305 | ifile_list ifile_p1 |
6c19b93b | 306 | | |
252b5132 RH |
307 | ; |
308 | ||
309 | ||
252b5132 RH |
310 | ifile_p1: |
311 | memory | |
312 | | sections | |
313 | | phdrs | |
314 | | startup | |
315 | | high_level_library | |
316 | | low_level_library | |
317 | | floating_point_support | |
318 | | statement_anywhere | |
319 | | version | |
6c19b93b | 320 | | ';' |
252b5132 RH |
321 | | TARGET_K '(' NAME ')' |
322 | { lang_add_target($3); } | |
323 | | SEARCH_DIR '(' filename ')' | |
f38a2680 | 324 | { ldfile_add_library_path ($3, false); } |
252b5132 RH |
325 | | OUTPUT '(' filename ')' |
326 | { lang_add_output($3, 1); } | |
6c19b93b | 327 | | OUTPUT_FORMAT '(' NAME ')' |
252b5132 RH |
328 | { lang_add_output_format ($3, (char *) NULL, |
329 | (char *) NULL, 1); } | |
330 | | OUTPUT_FORMAT '(' NAME ',' NAME ',' NAME ')' | |
331 | { lang_add_output_format ($3, $5, $7, 1); } | |
6c19b93b | 332 | | OUTPUT_ARCH '(' NAME ')' |
5e2f1575 | 333 | { ldfile_set_output_arch ($3, bfd_arch_unknown); } |
252b5132 | 334 | | FORCE_COMMON_ALLOCATION |
f38a2680 | 335 | { command_line.force_common_definition = true ; } |
7bdf4127 | 336 | | FORCE_GROUP_ALLOCATION |
f38a2680 | 337 | { command_line.force_group_allocation = true ; } |
4818e05f | 338 | | INHIBIT_COMMON_ALLOCATION |
f38a2680 | 339 | { link_info.inhibit_common_definition = true ; } |
252b5132 RH |
340 | | INPUT '(' input_list ')' |
341 | | GROUP | |
342 | { lang_enter_group (); } | |
343 | '(' input_list ')' | |
344 | { lang_leave_group (); } | |
6c19b93b | 345 | | MAP '(' filename ')' |
252b5132 | 346 | { lang_add_map($3); } |
d038301c | 347 | | INCLUDE filename |
3bb17dfb | 348 | { ldfile_open_command_file ($2); } |
b47c4208 | 349 | ifile_list END |
252b5132 RH |
350 | | NOCROSSREFS '(' nocrossref_list ')' |
351 | { | |
352 | lang_add_nocrossref ($3); | |
353 | } | |
cdf96953 MF |
354 | | NOCROSSREFS_TO '(' nocrossref_list ')' |
355 | { | |
356 | lang_add_nocrossref_to ($3); | |
357 | } | |
34a7af0f AM |
358 | | EXTERN '(' { ldlex_expression (); } extern_name_list ')' |
359 | { ldlex_popstate (); } | |
53d25da6 AM |
360 | | INSERT_K AFTER NAME |
361 | { lang_add_insert ($3, 0); } | |
362 | | INSERT_K BEFORE NAME | |
363 | { lang_add_insert ($3, 1); } | |
4a93e180 NC |
364 | | REGION_ALIAS '(' NAME ',' NAME ')' |
365 | { lang_memory_region_alias ($3, $5); } | |
01554a74 AM |
366 | | LD_FEATURE '(' NAME ')' |
367 | { lang_ld_feature ($3); } | |
252b5132 RH |
368 | ; |
369 | ||
370 | input_list: | |
eeed9cc7 HPN |
371 | { ldlex_inputlist(); } |
372 | input_list1 | |
373 | { ldlex_popstate(); } | |
374 | ||
375 | input_list1: | |
252b5132 RH |
376 | NAME |
377 | { lang_add_input_file($1,lang_input_file_is_search_file_enum, | |
378 | (char *)NULL); } | |
eeed9cc7 | 379 | | input_list1 ',' NAME |
252b5132 RH |
380 | { lang_add_input_file($3,lang_input_file_is_search_file_enum, |
381 | (char *)NULL); } | |
eeed9cc7 | 382 | | input_list1 NAME |
252b5132 RH |
383 | { lang_add_input_file($2,lang_input_file_is_search_file_enum, |
384 | (char *)NULL); } | |
385 | | LNAME | |
386 | { lang_add_input_file($1,lang_input_file_is_l_enum, | |
387 | (char *)NULL); } | |
eeed9cc7 | 388 | | input_list1 ',' LNAME |
252b5132 RH |
389 | { lang_add_input_file($3,lang_input_file_is_l_enum, |
390 | (char *)NULL); } | |
eeed9cc7 | 391 | | input_list1 LNAME |
252b5132 RH |
392 | { lang_add_input_file($2,lang_input_file_is_l_enum, |
393 | (char *)NULL); } | |
b717d30e | 394 | | AS_NEEDED '(' |
66be1055 | 395 | { $<integer>$ = input_flags.add_DT_NEEDED_for_regular; |
f38a2680 | 396 | input_flags.add_DT_NEEDED_for_regular = true; } |
eeed9cc7 | 397 | input_list1 ')' |
66be1055 | 398 | { input_flags.add_DT_NEEDED_for_regular = $<integer>3; } |
eeed9cc7 | 399 | | input_list1 ',' AS_NEEDED '(' |
66be1055 | 400 | { $<integer>$ = input_flags.add_DT_NEEDED_for_regular; |
f38a2680 | 401 | input_flags.add_DT_NEEDED_for_regular = true; } |
eeed9cc7 | 402 | input_list1 ')' |
66be1055 | 403 | { input_flags.add_DT_NEEDED_for_regular = $<integer>5; } |
eeed9cc7 | 404 | | input_list1 AS_NEEDED '(' |
66be1055 | 405 | { $<integer>$ = input_flags.add_DT_NEEDED_for_regular; |
f38a2680 | 406 | input_flags.add_DT_NEEDED_for_regular = true; } |
eeed9cc7 | 407 | input_list1 ')' |
66be1055 | 408 | { input_flags.add_DT_NEEDED_for_regular = $<integer>4; } |
252b5132 RH |
409 | ; |
410 | ||
411 | sections: | |
412 | SECTIONS '{' sec_or_group_p1 '}' | |
413 | ; | |
414 | ||
415 | sec_or_group_p1: | |
416 | sec_or_group_p1 section | |
417 | | sec_or_group_p1 statement_anywhere | |
418 | | | |
419 | ; | |
420 | ||
421 | statement_anywhere: | |
422 | ENTRY '(' NAME ')' | |
f38a2680 | 423 | { lang_add_entry ($3, false); } |
6c93cebf | 424 | | assignment separator |
b6ca8815 NS |
425 | | ASSERT_K {ldlex_expression ();} '(' exp ',' NAME ')' |
426 | { ldlex_popstate (); | |
427 | lang_add_assignment (exp_assert ($4, $6)); } | |
252b5132 RH |
428 | ; |
429 | ||
252b5132 RH |
430 | wildcard_name: |
431 | NAME | |
432 | { | |
433 | $$ = $1; | |
434 | } | |
252b5132 RH |
435 | ; |
436 | ||
2b94abd4 | 437 | wildcard_maybe_exclude: |
252b5132 RH |
438 | wildcard_name |
439 | { | |
440 | $$.name = $1; | |
bcaa7b3e | 441 | $$.sorted = none; |
18625d54 | 442 | $$.exclude_name_list = NULL; |
ae17ab41 | 443 | $$.section_flag_list = NULL; |
85921e9a | 444 | $$.reversed = false; |
252b5132 | 445 | } |
6c19b93b | 446 | | EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name |
252b5132 RH |
447 | { |
448 | $$.name = $5; | |
bcaa7b3e | 449 | $$.sorted = none; |
18625d54 | 450 | $$.exclude_name_list = $3; |
ae17ab41 | 451 | $$.section_flag_list = NULL; |
85921e9a | 452 | $$.reversed = false; |
252b5132 | 453 | } |
2b94abd4 AB |
454 | ; |
455 | ||
85921e9a | 456 | wildcard_maybe_reverse: |
2b94abd4 | 457 | wildcard_maybe_exclude |
85921e9a | 458 | | REVERSE '(' wildcard_maybe_exclude ')' |
252b5132 | 459 | { |
2b94abd4 | 460 | $$ = $3; |
85921e9a | 461 | $$.reversed = true; |
bcaa7b3e | 462 | $$.sorted = by_name; |
252b5132 | 463 | } |
85921e9a NC |
464 | ; |
465 | ||
466 | filename_spec: | |
467 | wildcard_maybe_reverse | |
468 | | SORT_BY_NAME '(' wildcard_maybe_reverse ')' | |
469 | { | |
470 | $$ = $3; | |
471 | $$.sorted = by_name; | |
472 | } | |
473 | | SORT_NONE '(' wildcard_maybe_reverse ')' | |
2b94abd4 AB |
474 | { |
475 | $$ = $3; | |
476 | $$.sorted = by_none; | |
85921e9a NC |
477 | $$.reversed = false; |
478 | } | |
479 | | REVERSE '(' SORT_BY_NAME '(' wildcard_maybe_exclude ')' ')' | |
480 | { | |
481 | $$ = $5; | |
482 | $$.sorted = by_name; | |
483 | $$.reversed = true; | |
2b94abd4 AB |
484 | } |
485 | ; | |
486 | ||
487 | section_name_spec: | |
85921e9a NC |
488 | wildcard_maybe_reverse |
489 | | SORT_BY_NAME '(' wildcard_maybe_reverse ')' | |
bcaa7b3e | 490 | { |
2b94abd4 AB |
491 | $$ = $3; |
492 | $$.sorted = by_name; | |
493 | } | |
85921e9a | 494 | | SORT_BY_ALIGNMENT '(' wildcard_maybe_reverse ')' |
2b94abd4 AB |
495 | { |
496 | $$ = $3; | |
bcaa7b3e | 497 | $$.sorted = by_alignment; |
bcaa7b3e | 498 | } |
85921e9a | 499 | | SORT_NONE '(' wildcard_maybe_reverse ')' |
eda680f8 | 500 | { |
2b94abd4 | 501 | $$ = $3; |
eda680f8 | 502 | $$.sorted = by_none; |
eda680f8 | 503 | } |
85921e9a | 504 | | SORT_BY_NAME '(' SORT_BY_ALIGNMENT '(' wildcard_maybe_reverse ')' ')' |
bcaa7b3e | 505 | { |
2b94abd4 | 506 | $$ = $5; |
bcaa7b3e | 507 | $$.sorted = by_name_alignment; |
bcaa7b3e | 508 | } |
85921e9a | 509 | | SORT_BY_NAME '(' SORT_BY_NAME '(' wildcard_maybe_reverse ')' ')' |
bcaa7b3e | 510 | { |
2b94abd4 | 511 | $$ = $5; |
bcaa7b3e | 512 | $$.sorted = by_name; |
bcaa7b3e | 513 | } |
85921e9a | 514 | | SORT_BY_ALIGNMENT '(' SORT_BY_NAME '(' wildcard_maybe_reverse ')' ')' |
bcaa7b3e | 515 | { |
2b94abd4 | 516 | $$ = $5; |
bcaa7b3e | 517 | $$.sorted = by_alignment_name; |
bcaa7b3e | 518 | } |
85921e9a | 519 | | SORT_BY_ALIGNMENT '(' SORT_BY_ALIGNMENT '(' wildcard_maybe_reverse ')' ')' |
bcaa7b3e | 520 | { |
2b94abd4 | 521 | $$ = $5; |
bcaa7b3e | 522 | $$.sorted = by_alignment; |
252b5132 | 523 | } |
85921e9a | 524 | | SORT_BY_INIT_PRIORITY '(' wildcard_maybe_reverse ')' |
02ecc8e9 | 525 | { |
2b94abd4 | 526 | $$ = $3; |
02ecc8e9 | 527 | $$.sorted = by_init_priority; |
ae17ab41 | 528 | } |
85921e9a NC |
529 | | REVERSE '(' SORT_BY_NAME '(' wildcard_maybe_exclude ')' ')' |
530 | { | |
531 | $$ = $5; | |
532 | $$.sorted = by_name; | |
533 | $$.reversed = true; | |
534 | } | |
535 | | REVERSE '(' SORT_BY_INIT_PRIORITY '(' wildcard_maybe_exclude ')' ')' | |
536 | { | |
537 | $$ = $5; | |
538 | $$.sorted = by_init_priority; | |
539 | $$.reversed = true; | |
540 | } | |
ae17ab41 CM |
541 | ; |
542 | ||
543 | sect_flag_list: NAME | |
544 | { | |
545 | struct flag_info_list *n; | |
546 | n = ((struct flag_info_list *) xmalloc (sizeof *n)); | |
547 | if ($1[0] == '!') | |
548 | { | |
549 | n->with = without_flags; | |
550 | n->name = &$1[1]; | |
551 | } | |
552 | else | |
553 | { | |
554 | n->with = with_flags; | |
555 | n->name = $1; | |
556 | } | |
f38a2680 | 557 | n->valid = false; |
ae17ab41 CM |
558 | n->next = NULL; |
559 | $$ = n; | |
560 | } | |
561 | | sect_flag_list '&' NAME | |
562 | { | |
563 | struct flag_info_list *n; | |
564 | n = ((struct flag_info_list *) xmalloc (sizeof *n)); | |
565 | if ($3[0] == '!') | |
566 | { | |
567 | n->with = without_flags; | |
568 | n->name = &$3[1]; | |
569 | } | |
570 | else | |
571 | { | |
572 | n->with = with_flags; | |
573 | n->name = $3; | |
574 | } | |
f38a2680 | 575 | n->valid = false; |
ae17ab41 CM |
576 | n->next = $1; |
577 | $$ = n; | |
578 | } | |
579 | ; | |
580 | ||
581 | sect_flags: | |
582 | INPUT_SECTION_FLAGS '(' sect_flag_list ')' | |
583 | { | |
584 | struct flag_info *n; | |
585 | n = ((struct flag_info *) xmalloc (sizeof *n)); | |
586 | n->flag_list = $3; | |
f38a2680 | 587 | n->flags_initialized = false; |
ae17ab41 CM |
588 | n->not_with_flags = 0; |
589 | n->only_with_flags = 0; | |
590 | $$ = n; | |
02ecc8e9 | 591 | } |
252b5132 RH |
592 | ; |
593 | ||
18625d54 | 594 | exclude_name_list: |
765b7cbe | 595 | exclude_name_list wildcard_name |
18625d54 CM |
596 | { |
597 | struct name_list *tmp; | |
598 | tmp = (struct name_list *) xmalloc (sizeof *tmp); | |
765b7cbe | 599 | tmp->name = $2; |
18625d54 | 600 | tmp->next = $1; |
d038301c | 601 | $$ = tmp; |
18625d54 CM |
602 | } |
603 | | | |
604 | wildcard_name | |
605 | { | |
606 | struct name_list *tmp; | |
607 | tmp = (struct name_list *) xmalloc (sizeof *tmp); | |
608 | tmp->name = $1; | |
609 | tmp->next = NULL; | |
610 | $$ = tmp; | |
611 | } | |
612 | ; | |
613 | ||
2b94abd4 AB |
614 | section_name_list: |
615 | section_name_list opt_comma section_name_spec | |
252b5132 | 616 | { |
b6bf44ba AM |
617 | struct wildcard_list *tmp; |
618 | tmp = (struct wildcard_list *) xmalloc (sizeof *tmp); | |
619 | tmp->next = $1; | |
620 | tmp->spec = $3; | |
621 | $$ = tmp; | |
252b5132 | 622 | } |
b6bf44ba | 623 | | |
2b94abd4 | 624 | section_name_spec |
252b5132 | 625 | { |
b6bf44ba AM |
626 | struct wildcard_list *tmp; |
627 | tmp = (struct wildcard_list *) xmalloc (sizeof *tmp); | |
628 | tmp->next = NULL; | |
629 | tmp->spec = $1; | |
630 | $$ = tmp; | |
252b5132 RH |
631 | } |
632 | ; | |
633 | ||
634 | input_section_spec_no_keep: | |
635 | NAME | |
636 | { | |
b6bf44ba AM |
637 | struct wildcard_spec tmp; |
638 | tmp.name = $1; | |
639 | tmp.exclude_name_list = NULL; | |
bcaa7b3e | 640 | tmp.sorted = none; |
ae17ab41 CM |
641 | tmp.section_flag_list = NULL; |
642 | lang_add_wild (&tmp, NULL, ldgram_had_keep); | |
643 | } | |
644 | | sect_flags NAME | |
645 | { | |
646 | struct wildcard_spec tmp; | |
647 | tmp.name = $2; | |
648 | tmp.exclude_name_list = NULL; | |
649 | tmp.sorted = none; | |
650 | tmp.section_flag_list = $1; | |
b6bf44ba | 651 | lang_add_wild (&tmp, NULL, ldgram_had_keep); |
252b5132 | 652 | } |
6c19b93b | 653 | | '[' section_name_list ']' |
252b5132 | 654 | { |
b6bf44ba | 655 | lang_add_wild (NULL, $2, ldgram_had_keep); |
252b5132 | 656 | } |
6c19b93b | 657 | | sect_flags '[' section_name_list ']' |
ae17ab41 CM |
658 | { |
659 | struct wildcard_spec tmp; | |
660 | tmp.name = NULL; | |
661 | tmp.exclude_name_list = NULL; | |
662 | tmp.sorted = none; | |
663 | tmp.section_flag_list = $1; | |
09f6ed34 | 664 | lang_add_wild (&tmp, $3, ldgram_had_keep); |
ae17ab41 | 665 | } |
2b94abd4 | 666 | | filename_spec '(' section_name_list ')' |
252b5132 | 667 | { |
b6bf44ba | 668 | lang_add_wild (&$1, $3, ldgram_had_keep); |
252b5132 | 669 | } |
2b94abd4 | 670 | | sect_flags filename_spec '(' section_name_list ')' |
ae17ab41 CM |
671 | { |
672 | $2.section_flag_list = $1; | |
673 | lang_add_wild (&$2, $4, ldgram_had_keep); | |
674 | } | |
252b5132 RH |
675 | ; |
676 | ||
677 | input_section_spec: | |
678 | input_section_spec_no_keep | |
679 | | KEEP '(' | |
f38a2680 | 680 | { ldgram_had_keep = true; } |
252b5132 | 681 | input_section_spec_no_keep ')' |
f38a2680 | 682 | { ldgram_had_keep = false; } |
252b5132 RH |
683 | ; |
684 | ||
685 | statement: | |
6c93cebf AM |
686 | ';' |
687 | | assignment separator | |
688 | | CREATE_OBJECT_SYMBOLS | |
252b5132 | 689 | { |
6c93cebf | 690 | lang_add_attribute (lang_object_symbols_statement_enum); |
6c19b93b | 691 | } |
6c93cebf | 692 | | CONSTRUCTORS |
252b5132 | 693 | { |
6c93cebf | 694 | lang_add_attribute (lang_constructors_statement_enum); |
252b5132 | 695 | } |
bcaa7b3e | 696 | | SORT_BY_NAME '(' CONSTRUCTORS ')' |
252b5132 | 697 | { |
f38a2680 | 698 | constructors_sorted = true; |
252b5132 RH |
699 | lang_add_attribute (lang_constructors_statement_enum); |
700 | } | |
701 | | input_section_spec | |
6c19b93b AM |
702 | | length '(' mustbe_exp ')' |
703 | { | |
704 | lang_add_data ((int) $1, $3); | |
705 | } | |
0d79a2a8 US |
706 | | ASCIZ NAME |
707 | { | |
a4d5aec7 | 708 | lang_add_string ($2); |
0d79a2a8 | 709 | } |
2c382fb6 | 710 | | FILL '(' fill_exp ')' |
6c19b93b AM |
711 | { |
712 | lang_add_fill ($3); | |
713 | } | |
2d5783fa NC |
714 | | LINKER_VERSION |
715 | { | |
716 | lang_add_version_string (); | |
717 | } | |
6c93cebf AM |
718 | | ASSERT_K |
719 | { ldlex_expression (); } | |
720 | '(' exp ',' NAME ')' separator | |
721 | { | |
722 | ldlex_popstate (); | |
723 | lang_add_assignment (exp_assert ($4, $6)); | |
724 | } | |
4006703d | 725 | | INCLUDE filename |
6c93cebf | 726 | { |
6c93cebf AM |
727 | ldfile_open_command_file ($2); |
728 | } | |
729 | statement_list_opt END | |
252b5132 RH |
730 | ; |
731 | ||
732 | statement_list: | |
733 | statement_list statement | |
6c19b93b | 734 | | statement |
252b5132 | 735 | ; |
d038301c | 736 | |
252b5132 RH |
737 | statement_list_opt: |
738 | /* empty */ | |
739 | | statement_list | |
740 | ; | |
741 | ||
742 | length: | |
743 | QUAD | |
744 | { $$ = $1; } | |
745 | | SQUAD | |
746 | { $$ = $1; } | |
747 | | LONG | |
748 | { $$ = $1; } | |
6c19b93b | 749 | | SHORT |
252b5132 RH |
750 | { $$ = $1; } |
751 | | BYTE | |
752 | { $$ = $1; } | |
753 | ; | |
754 | ||
2c382fb6 AM |
755 | fill_exp: |
756 | mustbe_exp | |
252b5132 | 757 | { |
02d44d76 | 758 | $$ = exp_get_fill ($1, 0, _("fill value")); |
252b5132 | 759 | } |
252b5132 RH |
760 | ; |
761 | ||
2c382fb6 AM |
762 | fill_opt: |
763 | '=' fill_exp | |
764 | { $$ = $2; } | |
6c19b93b | 765 | | { $$ = (fill_type *) 0; } |
2c382fb6 | 766 | ; |
252b5132 RH |
767 | |
768 | assign_op: | |
769 | PLUSEQ | |
770 | { $$ = '+'; } | |
771 | | MINUSEQ | |
772 | { $$ = '-'; } | |
6c19b93b | 773 | | MULTEQ |
252b5132 | 774 | { $$ = '*'; } |
6c19b93b | 775 | | DIVEQ |
252b5132 | 776 | { $$ = '/'; } |
6c19b93b | 777 | | LSHIFTEQ |
252b5132 | 778 | { $$ = LSHIFT; } |
6c19b93b | 779 | | RSHIFTEQ |
252b5132 | 780 | { $$ = RSHIFT; } |
6c19b93b | 781 | | ANDEQ |
252b5132 | 782 | { $$ = '&'; } |
6c19b93b | 783 | | OREQ |
252b5132 | 784 | { $$ = '|'; } |
b5c37946 SJ |
785 | | XOREQ |
786 | { $$ = '^'; } | |
252b5132 RH |
787 | |
788 | ; | |
789 | ||
6c93cebf | 790 | separator: ';' | ',' |
252b5132 RH |
791 | ; |
792 | ||
793 | ||
794 | assignment: | |
795 | NAME '=' mustbe_exp | |
796 | { | |
f38a2680 | 797 | lang_add_assignment (exp_assign ($1, $3, false)); |
252b5132 RH |
798 | } |
799 | | NAME assign_op mustbe_exp | |
800 | { | |
2e57b2af AM |
801 | lang_add_assignment (exp_assign ($1, |
802 | exp_binop ($2, | |
803 | exp_nameop (NAME, | |
804 | $1), | |
f38a2680 | 805 | $3), false)); |
eb8476a6 MR |
806 | } |
807 | | HIDDEN '(' NAME '=' mustbe_exp ')' | |
808 | { | |
f38a2680 | 809 | lang_add_assignment (exp_assign ($3, $5, true)); |
252b5132 RH |
810 | } |
811 | | PROVIDE '(' NAME '=' mustbe_exp ')' | |
812 | { | |
f38a2680 | 813 | lang_add_assignment (exp_provide ($3, $5, false)); |
7af8e998 L |
814 | } |
815 | | PROVIDE_HIDDEN '(' NAME '=' mustbe_exp ')' | |
816 | { | |
f38a2680 | 817 | lang_add_assignment (exp_provide ($3, $5, true)); |
252b5132 RH |
818 | } |
819 | ; | |
820 | ||
821 | ||
822 | opt_comma: | |
823 | ',' | ; | |
824 | ||
825 | ||
826 | memory: | |
4006703d | 827 | MEMORY '{' memory_spec_list_opt '}' |
252b5132 RH |
828 | ; |
829 | ||
4006703d NS |
830 | memory_spec_list_opt: memory_spec_list | ; |
831 | ||
252b5132 | 832 | memory_spec_list: |
4006703d NS |
833 | memory_spec_list opt_comma memory_spec |
834 | | memory_spec | |
252b5132 RH |
835 | ; |
836 | ||
837 | ||
6c19b93b | 838 | memory_spec: NAME |
f38a2680 | 839 | { region = lang_memory_region_lookup ($1, true); } |
252b5132 RH |
840 | attributes_opt ':' |
841 | origin_spec opt_comma length_spec | |
2d801b0f | 842 | {} |
4006703d | 843 | | INCLUDE filename |
3bb17dfb | 844 | { ldfile_open_command_file ($2); } |
4006703d | 845 | memory_spec_list_opt END |
74459f0e TW |
846 | ; |
847 | ||
848 | origin_spec: | |
252b5132 | 849 | ORIGIN '=' mustbe_exp |
e9ee469a | 850 | { |
cc9ad334 | 851 | region->origin_exp = $3; |
e9ee469a | 852 | } |
252b5132 RH |
853 | ; |
854 | ||
855 | length_spec: | |
6c19b93b | 856 | LENGTH '=' mustbe_exp |
e9ee469a | 857 | { |
a3e8dd2a AM |
858 | if (yychar == NAME) |
859 | { | |
860 | yyclearin; | |
861 | ldlex_backup (); | |
862 | } | |
cc9ad334 | 863 | region->length_exp = $3; |
252b5132 | 864 | } |
aa8804e4 | 865 | ; |
252b5132 RH |
866 | |
867 | attributes_opt: | |
aa8804e4 ILT |
868 | /* empty */ |
869 | { /* dummy action to avoid bison 1.25 error message */ } | |
870 | | '(' attributes_list ')' | |
871 | ; | |
872 | ||
873 | attributes_list: | |
874 | attributes_string | |
875 | | attributes_list attributes_string | |
876 | ; | |
877 | ||
878 | attributes_string: | |
879 | NAME | |
880 | { lang_set_flags (region, $1, 0); } | |
881 | | '!' NAME | |
882 | { lang_set_flags (region, $2, 1); } | |
252b5132 RH |
883 | ; |
884 | ||
885 | startup: | |
886 | STARTUP '(' filename ')' | |
887 | { lang_startup($3); } | |
888 | ; | |
889 | ||
890 | high_level_library: | |
891 | HLL '(' high_level_library_NAME_list ')' | |
892 | | HLL '(' ')' | |
893 | { ldemul_hll((char *)NULL); } | |
894 | ; | |
895 | ||
896 | high_level_library_NAME_list: | |
897 | high_level_library_NAME_list opt_comma filename | |
898 | { ldemul_hll($3); } | |
899 | | filename | |
900 | { ldemul_hll($1); } | |
252b5132 RH |
901 | ; |
902 | ||
903 | low_level_library: | |
904 | SYSLIB '(' low_level_library_NAME_list ')' | |
a5f92c67 AM |
905 | ; |
906 | ||
907 | low_level_library_NAME_list: | |
252b5132 RH |
908 | low_level_library_NAME_list opt_comma filename |
909 | { ldemul_syslib($3); } | |
910 | | | |
911 | ; | |
912 | ||
913 | floating_point_support: | |
914 | FLOAT | |
f38a2680 | 915 | { lang_float(true); } |
252b5132 | 916 | | NOFLOAT |
f38a2680 | 917 | { lang_float(false); } |
252b5132 | 918 | ; |
d038301c | 919 | |
252b5132 RH |
920 | nocrossref_list: |
921 | /* empty */ | |
922 | { | |
923 | $$ = NULL; | |
924 | } | |
925 | | NAME nocrossref_list | |
926 | { | |
927 | struct lang_nocrossref *n; | |
928 | ||
929 | n = (struct lang_nocrossref *) xmalloc (sizeof *n); | |
930 | n->name = $1; | |
931 | n->next = $2; | |
932 | $$ = n; | |
933 | } | |
934 | | NAME ',' nocrossref_list | |
935 | { | |
936 | struct lang_nocrossref *n; | |
937 | ||
938 | n = (struct lang_nocrossref *) xmalloc (sizeof *n); | |
939 | n->name = $1; | |
940 | n->next = $3; | |
941 | $$ = n; | |
942 | } | |
943 | ; | |
944 | ||
6c93cebf AM |
945 | paren_script_name: { ldlex_script (); } |
946 | '(' NAME ')' | |
947 | { ldlex_popstate (); $$ = $3; } | |
553dd76c | 948 | |
6c93cebf | 949 | mustbe_exp: { ldlex_expression (); } |
252b5132 | 950 | exp |
6c93cebf | 951 | { ldlex_popstate (); $$ = $2; } |
252b5132 RH |
952 | ; |
953 | ||
954 | exp : | |
955 | '-' exp %prec UNARY | |
3ec57632 | 956 | { $$ = exp_unop ('-', $2); } |
252b5132 RH |
957 | | '(' exp ')' |
958 | { $$ = $2; } | |
959 | | NEXT '(' exp ')' %prec UNARY | |
3ec57632 | 960 | { $$ = exp_unop ((int) $1,$3); } |
252b5132 | 961 | | '!' exp %prec UNARY |
3ec57632 | 962 | { $$ = exp_unop ('!', $2); } |
252b5132 RH |
963 | | '+' exp %prec UNARY |
964 | { $$ = $2; } | |
965 | | '~' exp %prec UNARY | |
3ec57632 | 966 | { $$ = exp_unop ('~', $2);} |
252b5132 RH |
967 | |
968 | | exp '*' exp | |
3ec57632 | 969 | { $$ = exp_binop ('*', $1, $3); } |
252b5132 | 970 | | exp '/' exp |
3ec57632 | 971 | { $$ = exp_binop ('/', $1, $3); } |
252b5132 | 972 | | exp '%' exp |
3ec57632 | 973 | { $$ = exp_binop ('%', $1, $3); } |
252b5132 | 974 | | exp '+' exp |
3ec57632 | 975 | { $$ = exp_binop ('+', $1, $3); } |
252b5132 | 976 | | exp '-' exp |
3ec57632 | 977 | { $$ = exp_binop ('-' , $1, $3); } |
252b5132 | 978 | | exp LSHIFT exp |
3ec57632 | 979 | { $$ = exp_binop (LSHIFT , $1, $3); } |
252b5132 | 980 | | exp RSHIFT exp |
3ec57632 | 981 | { $$ = exp_binop (RSHIFT , $1, $3); } |
252b5132 | 982 | | exp EQ exp |
3ec57632 | 983 | { $$ = exp_binop (EQ , $1, $3); } |
252b5132 | 984 | | exp NE exp |
3ec57632 | 985 | { $$ = exp_binop (NE , $1, $3); } |
252b5132 | 986 | | exp LE exp |
3ec57632 | 987 | { $$ = exp_binop (LE , $1, $3); } |
6c19b93b | 988 | | exp GE exp |
3ec57632 | 989 | { $$ = exp_binop (GE , $1, $3); } |
252b5132 | 990 | | exp '<' exp |
3ec57632 | 991 | { $$ = exp_binop ('<' , $1, $3); } |
252b5132 | 992 | | exp '>' exp |
3ec57632 | 993 | { $$ = exp_binop ('>' , $1, $3); } |
252b5132 | 994 | | exp '&' exp |
3ec57632 | 995 | { $$ = exp_binop ('&' , $1, $3); } |
252b5132 | 996 | | exp '^' exp |
3ec57632 | 997 | { $$ = exp_binop ('^' , $1, $3); } |
252b5132 | 998 | | exp '|' exp |
3ec57632 | 999 | { $$ = exp_binop ('|' , $1, $3); } |
252b5132 | 1000 | | exp '?' exp ':' exp |
3ec57632 | 1001 | { $$ = exp_trinop ('?' , $1, $3, $5); } |
252b5132 | 1002 | | exp ANDAND exp |
3ec57632 | 1003 | { $$ = exp_binop (ANDAND , $1, $3); } |
252b5132 | 1004 | | exp OROR exp |
3ec57632 | 1005 | { $$ = exp_binop (OROR , $1, $3); } |
252b5132 | 1006 | | DEFINED '(' NAME ')' |
3ec57632 | 1007 | { $$ = exp_nameop (DEFINED, $3); } |
252b5132 | 1008 | | INT |
2c382fb6 | 1009 | { $$ = exp_bigintop ($1.integer, $1.str); } |
6c19b93b | 1010 | | SIZEOF_HEADERS |
3ec57632 | 1011 | { $$ = exp_nameop (SIZEOF_HEADERS,0); } |
252b5132 | 1012 | |
553dd76c AM |
1013 | | ALIGNOF paren_script_name |
1014 | { $$ = exp_nameop (ALIGNOF, $2); } | |
1015 | | SIZEOF paren_script_name | |
1016 | { $$ = exp_nameop (SIZEOF, $2); } | |
1017 | | ADDR paren_script_name | |
1018 | { $$ = exp_nameop (ADDR, $2); } | |
1019 | | LOADADDR paren_script_name | |
1020 | { $$ = exp_nameop (LOADADDR, $2); } | |
24718e3b L |
1021 | | CONSTANT '(' NAME ')' |
1022 | { $$ = exp_nameop (CONSTANT,$3); } | |
252b5132 | 1023 | | ABSOLUTE '(' exp ')' |
3ec57632 | 1024 | { $$ = exp_unop (ABSOLUTE, $3); } |
252b5132 | 1025 | | ALIGN_K '(' exp ')' |
3ec57632 | 1026 | { $$ = exp_unop (ALIGN_K,$3); } |
876f4090 | 1027 | | ALIGN_K '(' exp ',' exp ')' |
3ec57632 | 1028 | { $$ = exp_binop (ALIGN_K,$3,$5); } |
2d20f7bf JJ |
1029 | | DATA_SEGMENT_ALIGN '(' exp ',' exp ')' |
1030 | { $$ = exp_binop (DATA_SEGMENT_ALIGN, $3, $5); } | |
a4f5ad88 JJ |
1031 | | DATA_SEGMENT_RELRO_END '(' exp ',' exp ')' |
1032 | { $$ = exp_binop (DATA_SEGMENT_RELRO_END, $5, $3); } | |
2d20f7bf | 1033 | | DATA_SEGMENT_END '(' exp ')' |
3ec57632 | 1034 | { $$ = exp_unop (DATA_SEGMENT_END, $3); } |
553dd76c AM |
1035 | | SEGMENT_START { ldlex_script (); } '(' NAME |
1036 | { ldlex_popstate (); } ',' exp ')' | |
6c19b93b | 1037 | { /* The operands to the expression node are |
ba916c8a MM |
1038 | placed in the opposite order from the way |
1039 | in which they appear in the script as | |
1040 | that allows us to reuse more code in | |
1041 | fold_binary. */ | |
1042 | $$ = exp_binop (SEGMENT_START, | |
553dd76c AM |
1043 | $7, |
1044 | exp_nameop (NAME, $4)); } | |
252b5132 | 1045 | | BLOCK '(' exp ')' |
3ec57632 | 1046 | { $$ = exp_unop (ALIGN_K,$3); } |
252b5132 | 1047 | | NAME |
3ec57632 | 1048 | { $$ = exp_nameop (NAME,$1); } |
252b5132 RH |
1049 | | MAX_K '(' exp ',' exp ')' |
1050 | { $$ = exp_binop (MAX_K, $3, $5 ); } | |
1051 | | MIN_K '(' exp ',' exp ')' | |
1052 | { $$ = exp_binop (MIN_K, $3, $5 ); } | |
1053 | | ASSERT_K '(' exp ',' NAME ')' | |
1054 | { $$ = exp_assert ($3, $5); } | |
af29a8ab AM |
1055 | | ORIGIN paren_script_name |
1056 | { $$ = exp_nameop (ORIGIN, $2); } | |
1057 | | LENGTH paren_script_name | |
1058 | { $$ = exp_nameop (LENGTH, $2); } | |
2e53f7d6 NC |
1059 | | LOG2CEIL '(' exp ')' |
1060 | { $$ = exp_unop (LOG2CEIL, $3); } | |
252b5132 RH |
1061 | ; |
1062 | ||
1063 | ||
562d3460 | 1064 | memspec_at_opt: |
6c19b93b AM |
1065 | AT '>' NAME { $$ = $3; } |
1066 | | { $$ = 0; } | |
1067 | ; | |
562d3460 | 1068 | |
252b5132 RH |
1069 | opt_at: |
1070 | AT '(' exp ')' { $$ = $3; } | |
1071 | | { $$ = 0; } | |
1072 | ; | |
1073 | ||
bbf115d3 L |
1074 | opt_align: |
1075 | ALIGN_K '(' exp ')' { $$ = $3; } | |
1076 | | { $$ = 0; } | |
1077 | ; | |
1078 | ||
1eec346e NC |
1079 | opt_align_with_input: |
1080 | ALIGN_WITH_INPUT { $$ = ALIGN_WITH_INPUT; } | |
1081 | | { $$ = 0; } | |
1082 | ; | |
1083 | ||
7e7d5768 AM |
1084 | opt_subalign: |
1085 | SUBALIGN '(' exp ')' { $$ = $3; } | |
1086 | | { $$ = 0; } | |
1087 | ; | |
1088 | ||
0841712e JJ |
1089 | sect_constraint: |
1090 | ONLY_IF_RO { $$ = ONLY_IF_RO; } | |
1091 | | ONLY_IF_RW { $$ = ONLY_IF_RW; } | |
0cf7d72c | 1092 | | SPECIAL { $$ = SPECIAL; } |
0841712e JJ |
1093 | | { $$ = 0; } |
1094 | ; | |
1095 | ||
6c93cebf AM |
1096 | section: NAME |
1097 | { ldlex_expression(); } | |
d038301c | 1098 | opt_exp_with_type |
7e7d5768 | 1099 | opt_at |
bbf115d3 | 1100 | opt_align |
1eec346e | 1101 | opt_align_with_input |
6c93cebf | 1102 | opt_subalign |
0841712e | 1103 | sect_constraint |
252b5132 | 1104 | { |
af29a8ab AM |
1105 | ldlex_popstate (); |
1106 | ldlex_wild (); | |
c212f39d FS |
1107 | lang_enter_output_section_statement ($1, $3, sectype, |
1108 | sectype_value, $5, $7, $4, $8, $6); | |
252b5132 | 1109 | } |
af29a8ab | 1110 | '{' |
d038301c | 1111 | statement_list_opt |
6c93cebf | 1112 | '}' |
af29a8ab | 1113 | { ldlex_popstate (); } |
562d3460 | 1114 | memspec_opt memspec_at_opt phdr_opt fill_opt |
6c93cebf | 1115 | { |
4ffb22ec AM |
1116 | /* fill_opt may have switched the lexer into |
1117 | expression state, and back again, but in | |
1118 | order to find the end of the fill | |
1119 | expression the parser must look ahead one | |
1120 | token. If it is a NAME, throw it away as | |
1121 | it will have been lexed in the wrong | |
1122 | state. */ | |
1123 | if (yychar == NAME) | |
1124 | { | |
1125 | yyclearin; | |
1126 | ldlex_backup (); | |
1127 | } | |
af29a8ab AM |
1128 | lang_leave_output_section_statement ($17, $14, |
1129 | $16, $15); | |
6c93cebf | 1130 | } |
252b5132 RH |
1131 | opt_comma |
1132 | | OVERLAY | |
1133 | { ldlex_expression (); } | |
7e7d5768 | 1134 | opt_exp_without_type opt_nocrossrefs opt_at opt_subalign |
af29a8ab | 1135 | { ldlex_popstate (); } |
d038301c | 1136 | '{' |
252b5132 | 1137 | { |
7e7d5768 | 1138 | lang_enter_overlay ($3, $6); |
252b5132 RH |
1139 | } |
1140 | overlay_section | |
1141 | '}' | |
562d3460 | 1142 | memspec_opt memspec_at_opt phdr_opt fill_opt |
252b5132 | 1143 | { |
4ffb22ec AM |
1144 | if (yychar == NAME) |
1145 | { | |
1146 | yyclearin; | |
1147 | ldlex_backup (); | |
1148 | } | |
9f88b410 | 1149 | lang_leave_overlay ($5, (int) $4, |
af29a8ab | 1150 | $15, $12, $14, $13); |
252b5132 RH |
1151 | } |
1152 | opt_comma | |
1153 | | /* The GROUP case is just enough to support the gcc | |
1154 | svr3.ifile script. It is not intended to be full | |
1155 | support. I'm not even sure what GROUP is supposed | |
1156 | to mean. */ | |
6c93cebf AM |
1157 | GROUP |
1158 | { ldlex_expression (); } | |
252b5132 | 1159 | opt_exp_with_type |
6c93cebf AM |
1160 | { |
1161 | ldlex_popstate (); | |
1162 | lang_add_assignment (exp_assign (".", $3, false)); | |
1163 | } | |
252b5132 | 1164 | '{' sec_or_group_p1 '}' |
4006703d | 1165 | | INCLUDE filename |
6c93cebf | 1166 | { |
6c93cebf AM |
1167 | ldfile_open_command_file ($2); |
1168 | } | |
4006703d | 1169 | sec_or_group_p1 END |
252b5132 RH |
1170 | ; |
1171 | ||
1172 | type: | |
1173 | NOLOAD { sectype = noload_section; } | |
02a38f92 AM |
1174 | | DSECT { sectype = noalloc_section; } |
1175 | | COPY { sectype = noalloc_section; } | |
1176 | | INFO { sectype = noalloc_section; } | |
1177 | | OVERLAY { sectype = noalloc_section; } | |
c212f39d | 1178 | | READONLY '(' TYPE '=' exp ')' { sectype = typed_readonly_section; sectype_value = $5; } |
6b86da53 | 1179 | | READONLY { sectype = readonly_section; } |
c212f39d FS |
1180 | | TYPE '=' exp { sectype = type_section; sectype_value = $3; } |
1181 | ; | |
252b5132 RH |
1182 | |
1183 | atype: | |
6c19b93b AM |
1184 | '(' type ')' |
1185 | | /* EMPTY */ { sectype = normal_section; } | |
1186 | | '(' ')' { sectype = normal_section; } | |
252b5132 RH |
1187 | ; |
1188 | ||
1189 | opt_exp_with_type: | |
1190 | exp atype ':' { $$ = $1; } | |
1191 | | atype ':' { $$ = (etree_type *)NULL; } | |
1192 | | /* The BIND cases are to support the gcc svr3.ifile | |
1193 | script. They aren't intended to implement full | |
1194 | support for the BIND keyword. I'm not even sure | |
1195 | what BIND is supposed to mean. */ | |
1196 | BIND '(' exp ')' atype ':' { $$ = $3; } | |
1197 | | BIND '(' exp ')' BLOCK '(' exp ')' atype ':' | |
1198 | { $$ = $3; } | |
1199 | ; | |
1200 | ||
1201 | opt_exp_without_type: | |
1202 | exp ':' { $$ = $1; } | |
1203 | | ':' { $$ = (etree_type *) NULL; } | |
1204 | ; | |
1205 | ||
1206 | opt_nocrossrefs: | |
1207 | /* empty */ | |
1208 | { $$ = 0; } | |
1209 | | NOCROSSREFS | |
1210 | { $$ = 1; } | |
1211 | ; | |
1212 | ||
1213 | memspec_opt: | |
1214 | '>' NAME | |
1215 | { $$ = $2; } | |
a747ee4d | 1216 | | { $$ = DEFAULT_MEMORY_REGION; } |
252b5132 RH |
1217 | ; |
1218 | ||
1219 | phdr_opt: | |
1220 | /* empty */ | |
1221 | { | |
1222 | $$ = NULL; | |
1223 | } | |
1224 | | phdr_opt ':' NAME | |
1225 | { | |
1226 | struct lang_output_section_phdr_list *n; | |
1227 | ||
1228 | n = ((struct lang_output_section_phdr_list *) | |
1229 | xmalloc (sizeof *n)); | |
1230 | n->name = $3; | |
f38a2680 | 1231 | n->used = false; |
252b5132 RH |
1232 | n->next = $1; |
1233 | $$ = n; | |
1234 | } | |
1235 | ; | |
1236 | ||
1237 | overlay_section: | |
1238 | /* empty */ | |
1239 | | overlay_section | |
1240 | NAME | |
1241 | { | |
af29a8ab | 1242 | ldlex_wild (); |
252b5132 RH |
1243 | lang_enter_overlay_section ($2); |
1244 | } | |
af29a8ab AM |
1245 | '{' |
1246 | statement_list_opt | |
1247 | '}' | |
1248 | { ldlex_popstate (); } | |
252b5132 RH |
1249 | phdr_opt fill_opt |
1250 | { | |
4ffb22ec AM |
1251 | if (yychar == NAME) |
1252 | { | |
1253 | yyclearin; | |
1254 | ldlex_backup (); | |
1255 | } | |
252b5132 RH |
1256 | lang_leave_overlay_section ($9, $8); |
1257 | } | |
1258 | opt_comma | |
1259 | ; | |
1260 | ||
1261 | phdrs: | |
1262 | PHDRS '{' phdr_list '}' | |
1263 | ; | |
1264 | ||
1265 | phdr_list: | |
1266 | /* empty */ | |
1267 | | phdr_list phdr | |
1268 | ; | |
1269 | ||
1270 | phdr: | |
1271 | NAME { ldlex_expression (); } | |
1272 | phdr_type phdr_qualifiers { ldlex_popstate (); } | |
1273 | ';' | |
1274 | { | |
1275 | lang_new_phdr ($1, $3, $4.filehdr, $4.phdrs, $4.at, | |
1276 | $4.flags); | |
1277 | } | |
1278 | ; | |
1279 | ||
1280 | phdr_type: | |
1281 | exp | |
1282 | { | |
1283 | $$ = $1; | |
1284 | ||
1285 | if ($1->type.node_class == etree_name | |
1286 | && $1->type.node_code == NAME) | |
1287 | { | |
1288 | const char *s; | |
1289 | unsigned int i; | |
1290 | static const char * const phdr_types[] = | |
1291 | { | |
1292 | "PT_NULL", "PT_LOAD", "PT_DYNAMIC", | |
1293 | "PT_INTERP", "PT_NOTE", "PT_SHLIB", | |
d038301c | 1294 | "PT_PHDR", "PT_TLS" |
252b5132 RH |
1295 | }; |
1296 | ||
1297 | s = $1->name.name; | |
1298 | for (i = 0; | |
1299 | i < sizeof phdr_types / sizeof phdr_types[0]; | |
1300 | i++) | |
1301 | if (strcmp (s, phdr_types[i]) == 0) | |
1302 | { | |
1303 | $$ = exp_intop (i); | |
1304 | break; | |
1305 | } | |
d038301c RM |
1306 | if (i == sizeof phdr_types / sizeof phdr_types[0]) |
1307 | { | |
1308 | if (strcmp (s, "PT_GNU_EH_FRAME") == 0) | |
1309 | $$ = exp_intop (0x6474e550); | |
9ee5e499 JJ |
1310 | else if (strcmp (s, "PT_GNU_STACK") == 0) |
1311 | $$ = exp_intop (0x6474e551); | |
ee9e412f NC |
1312 | else if (strcmp (s, "PT_GNU_RELRO") == 0) |
1313 | $$ = exp_intop (0x6474e552); | |
1314 | else if (strcmp (s, "PT_GNU_PROPERTY") == 0) | |
1315 | $$ = exp_intop (0x6474e553); | |
d038301c RM |
1316 | else |
1317 | { | |
1318 | einfo (_("\ | |
c1c8c1ef | 1319 | %X%P:%pS: unknown phdr type `%s' (try integer literal)\n"), |
dab69f68 | 1320 | NULL, s); |
d038301c RM |
1321 | $$ = exp_intop (0); |
1322 | } | |
1323 | } | |
252b5132 RH |
1324 | } |
1325 | } | |
1326 | ; | |
1327 | ||
1328 | phdr_qualifiers: | |
1329 | /* empty */ | |
1330 | { | |
1331 | memset (&$$, 0, sizeof (struct phdr_info)); | |
1332 | } | |
1333 | | NAME phdr_val phdr_qualifiers | |
1334 | { | |
1335 | $$ = $3; | |
1336 | if (strcmp ($1, "FILEHDR") == 0 && $2 == NULL) | |
f38a2680 | 1337 | $$.filehdr = true; |
252b5132 | 1338 | else if (strcmp ($1, "PHDRS") == 0 && $2 == NULL) |
f38a2680 | 1339 | $$.phdrs = true; |
252b5132 RH |
1340 | else if (strcmp ($1, "FLAGS") == 0 && $2 != NULL) |
1341 | $$.flags = $2; | |
1342 | else | |
c1c8c1ef | 1343 | einfo (_("%X%P:%pS: PHDRS syntax error at `%s'\n"), |
dab69f68 | 1344 | NULL, $1); |
252b5132 RH |
1345 | } |
1346 | | AT '(' exp ')' phdr_qualifiers | |
1347 | { | |
1348 | $$ = $5; | |
1349 | $$.at = $3; | |
1350 | } | |
1351 | ; | |
1352 | ||
1353 | phdr_val: | |
1354 | /* empty */ | |
1355 | { | |
1356 | $$ = NULL; | |
1357 | } | |
1358 | | '(' exp ')' | |
1359 | { | |
1360 | $$ = $2; | |
1361 | } | |
1362 | ; | |
1363 | ||
55255dae L |
1364 | dynamic_list_file: |
1365 | { | |
1366 | ldlex_version_file (); | |
1367 | PUSH_ERROR (_("dynamic list")); | |
1368 | } | |
1369 | dynamic_list_nodes | |
1370 | { | |
1371 | ldlex_popstate (); | |
1372 | POP_ERROR (); | |
1373 | } | |
1374 | ; | |
1375 | ||
1376 | dynamic_list_nodes: | |
1377 | dynamic_list_node | |
1378 | | dynamic_list_nodes dynamic_list_node | |
1379 | ; | |
1380 | ||
1381 | dynamic_list_node: | |
1382 | '{' dynamic_list_tag '}' ';' | |
1383 | ; | |
1384 | ||
1385 | dynamic_list_tag: | |
1386 | vers_defns ';' | |
1387 | { | |
37a141bf | 1388 | lang_append_dynamic_list (current_dynamic_list_p, $1); |
55255dae L |
1389 | } |
1390 | ; | |
1391 | ||
252b5132 RH |
1392 | /* This syntax is used within an external version script file. */ |
1393 | ||
1394 | version_script_file: | |
1395 | { | |
1396 | ldlex_version_file (); | |
1397 | PUSH_ERROR (_("VERSION script")); | |
1398 | } | |
1399 | vers_nodes | |
1400 | { | |
1401 | ldlex_popstate (); | |
1402 | POP_ERROR (); | |
1403 | } | |
1404 | ; | |
1405 | ||
1406 | /* This is used within a normal linker script file. */ | |
1407 | ||
1408 | version: | |
1409 | { | |
1410 | ldlex_version_script (); | |
1411 | } | |
1412 | VERSIONK '{' vers_nodes '}' | |
1413 | { | |
1414 | ldlex_popstate (); | |
1415 | } | |
1416 | ; | |
1417 | ||
1418 | vers_nodes: | |
1419 | vers_node | |
1420 | | vers_nodes vers_node | |
1421 | ; | |
1422 | ||
1423 | vers_node: | |
6b9b879a JJ |
1424 | '{' vers_tag '}' ';' |
1425 | { | |
1426 | lang_register_vers_node (NULL, $2, NULL); | |
1427 | } | |
1428 | | VERS_TAG '{' vers_tag '}' ';' | |
252b5132 RH |
1429 | { |
1430 | lang_register_vers_node ($1, $3, NULL); | |
1431 | } | |
1432 | | VERS_TAG '{' vers_tag '}' verdep ';' | |
1433 | { | |
1434 | lang_register_vers_node ($1, $3, $5); | |
1435 | } | |
1436 | ; | |
1437 | ||
1438 | verdep: | |
1439 | VERS_TAG | |
1440 | { | |
1441 | $$ = lang_add_vers_depend (NULL, $1); | |
1442 | } | |
1443 | | verdep VERS_TAG | |
1444 | { | |
1445 | $$ = lang_add_vers_depend ($1, $2); | |
1446 | } | |
1447 | ; | |
1448 | ||
1449 | vers_tag: | |
1450 | /* empty */ | |
1451 | { | |
1452 | $$ = lang_new_vers_node (NULL, NULL); | |
1453 | } | |
1454 | | vers_defns ';' | |
1455 | { | |
1456 | $$ = lang_new_vers_node ($1, NULL); | |
1457 | } | |
1458 | | GLOBAL ':' vers_defns ';' | |
1459 | { | |
1460 | $$ = lang_new_vers_node ($3, NULL); | |
1461 | } | |
1462 | | LOCAL ':' vers_defns ';' | |
1463 | { | |
1464 | $$ = lang_new_vers_node (NULL, $3); | |
1465 | } | |
1466 | | GLOBAL ':' vers_defns ';' LOCAL ':' vers_defns ';' | |
1467 | { | |
1468 | $$ = lang_new_vers_node ($3, $7); | |
1469 | } | |
1470 | ; | |
1471 | ||
1472 | vers_defns: | |
1473 | VERS_IDENTIFIER | |
1474 | { | |
f38a2680 | 1475 | $$ = lang_new_vers_pattern (NULL, $1, ldgram_vers_current_lang, false); |
86043bbb | 1476 | } |
6c19b93b | 1477 | | NAME |
86043bbb | 1478 | { |
f38a2680 | 1479 | $$ = lang_new_vers_pattern (NULL, $1, ldgram_vers_current_lang, true); |
252b5132 RH |
1480 | } |
1481 | | vers_defns ';' VERS_IDENTIFIER | |
1482 | { | |
f38a2680 | 1483 | $$ = lang_new_vers_pattern ($1, $3, ldgram_vers_current_lang, false); |
86043bbb MM |
1484 | } |
1485 | | vers_defns ';' NAME | |
1486 | { | |
f38a2680 | 1487 | $$ = lang_new_vers_pattern ($1, $3, ldgram_vers_current_lang, true); |
252b5132 | 1488 | } |
8e23b15d AM |
1489 | | vers_defns ';' EXTERN NAME '{' |
1490 | { | |
1491 | $<name>$ = ldgram_vers_current_lang; | |
1492 | ldgram_vers_current_lang = $4; | |
1493 | } | |
1494 | vers_defns opt_semicolon '}' | |
1495 | { | |
96f8ade5 JJ |
1496 | struct bfd_elf_version_expr *pat; |
1497 | for (pat = $7; pat->next != NULL; pat = pat->next); | |
1498 | pat->next = $1; | |
8e23b15d AM |
1499 | $$ = $7; |
1500 | ldgram_vers_current_lang = $<name>6; | |
1501 | } | |
252b5132 RH |
1502 | | EXTERN NAME '{' |
1503 | { | |
1504 | $<name>$ = ldgram_vers_current_lang; | |
1505 | ldgram_vers_current_lang = $2; | |
1506 | } | |
8e23b15d | 1507 | vers_defns opt_semicolon '}' |
252b5132 | 1508 | { |
e06cae36 | 1509 | $$ = $5; |
252b5132 RH |
1510 | ldgram_vers_current_lang = $<name>4; |
1511 | } | |
96f8ade5 JJ |
1512 | | GLOBAL |
1513 | { | |
f38a2680 | 1514 | $$ = lang_new_vers_pattern (NULL, "global", ldgram_vers_current_lang, false); |
96f8ade5 JJ |
1515 | } |
1516 | | vers_defns ';' GLOBAL | |
1517 | { | |
f38a2680 | 1518 | $$ = lang_new_vers_pattern ($1, "global", ldgram_vers_current_lang, false); |
96f8ade5 JJ |
1519 | } |
1520 | | LOCAL | |
1521 | { | |
f38a2680 | 1522 | $$ = lang_new_vers_pattern (NULL, "local", ldgram_vers_current_lang, false); |
96f8ade5 JJ |
1523 | } |
1524 | | vers_defns ';' LOCAL | |
1525 | { | |
f38a2680 | 1526 | $$ = lang_new_vers_pattern ($1, "local", ldgram_vers_current_lang, false); |
96f8ade5 JJ |
1527 | } |
1528 | | EXTERN | |
1529 | { | |
f38a2680 | 1530 | $$ = lang_new_vers_pattern (NULL, "extern", ldgram_vers_current_lang, false); |
96f8ade5 JJ |
1531 | } |
1532 | | vers_defns ';' EXTERN | |
1533 | { | |
f38a2680 | 1534 | $$ = lang_new_vers_pattern ($1, "extern", ldgram_vers_current_lang, false); |
96f8ade5 | 1535 | } |
252b5132 RH |
1536 | ; |
1537 | ||
8e23b15d AM |
1538 | opt_semicolon: |
1539 | /* empty */ | |
1540 | | ';' | |
1541 | ; | |
1542 | ||
6e8376fa NC |
1543 | section_ordering_script_file: |
1544 | { | |
1545 | ldlex_script (); | |
1546 | PUSH_ERROR (_("section-ordering-file script")); | |
1547 | } | |
1548 | section_ordering_list | |
1549 | { | |
1550 | ldlex_popstate (); | |
1551 | POP_ERROR (); | |
1552 | } | |
1553 | ; | |
1554 | ||
1555 | section_ordering_list: | |
1556 | section_ordering_list section_order | |
1557 | | section_ordering_list statement_anywhere | |
1558 | | | |
1559 | ; | |
1560 | ||
1561 | section_order: NAME ':' | |
1562 | { | |
1563 | ldlex_wild (); | |
1564 | lang_enter_output_section_statement | |
1565 | ($1, NULL, 0, NULL, NULL, NULL, NULL, 0, 0); | |
1566 | } | |
1567 | '{' | |
1568 | statement_list_opt | |
1569 | '}' | |
1570 | { | |
1571 | ldlex_popstate (); | |
1572 | lang_leave_output_section_statement (NULL, NULL, NULL, NULL); | |
1573 | } | |
1574 | opt_comma | |
1575 | ||
252b5132 | 1576 | %% |
b5c37946 SJ |
1577 | static void |
1578 | yyerror (const char *arg) | |
d038301c | 1579 | { |
252b5132 RH |
1580 | if (ldfile_assumed_script) |
1581 | einfo (_("%P:%s: file format not recognized; treating as linker script\n"), | |
dab69f68 | 1582 | ldlex_filename ()); |
252b5132 | 1583 | if (error_index > 0 && error_index < ERROR_NAME_MAX) |
02d44d76 | 1584 | einfo (_("%F%P:%pS: %s in %s\n"), NULL, arg, error_names[error_index - 1]); |
252b5132 | 1585 | else |
df5f2391 | 1586 | einfo ("%F%P:%pS: %s\n", NULL, arg); |
252b5132 | 1587 | } |