]>
Commit | Line | Data |
---|---|---|
1418c83b | 1 | %{ |
2fa0b342 DHW |
2 | /* |
3 | * $Id$ | |
4 | * | |
2fa0b342 DHW |
5 | * |
6 | */ | |
7 | ||
8 | /* | |
9 | This is a YACC grammer intended to parse a superset of the AT&T | |
10 | linker scripting languaue. | |
11 | ||
12 | ||
13 | Written by Steve Chamberlain [email protected] | |
14 | */ | |
15 | ||
16 | ||
2fa0b342 DHW |
17 | |
18 | #include "sysdep.h" | |
19 | #include "bfd.h" | |
2fa0b342 DHW |
20 | #include "ld.h" |
21 | #include "ldexp.h" | |
7cb9aa50 | 22 | #include "ldver.h" |
2fa0b342 DHW |
23 | #include "ldlang.h" |
24 | #include "ld-emul.h" | |
25 | #include "ldfile.h" | |
26 | #include "ldmisc.h" | |
27 | #define YYDEBUG 1 | |
28 | ||
29 | boolean option_v; | |
2fa0b342 DHW |
30 | extern unsigned int lineno; |
31 | extern boolean trace_files; | |
32 | extern boolean write_map; | |
33 | ||
34 | boolean hex_mode; | |
35 | ||
d646b568 SC |
36 | strip_symbols_type strip_symbols=STRIP_NONE; |
37 | discard_locals_type discard_locals=DISCARD_NONE; | |
2fa0b342 DHW |
38 | |
39 | ||
40 | lang_memory_region_type *region; | |
41 | ||
42 | ||
43 | lang_memory_region_type *lang_memory_region_lookup(); | |
44 | lang_output_section_statement_type *lang_output_section_statement_lookup(); | |
45 | ||
46 | #ifdef __STDC__ | |
47 | ||
48 | void lang_add_data(int type, union etree_union *exp); | |
49 | void lang_enter_output_section_statement(char *output_section_statement_name, etree_type *address_exp, bfd_vma block_value); | |
50 | ||
51 | #else | |
52 | ||
53 | void lang_add_data(); | |
54 | void lang_enter_output_section_statement(); | |
55 | ||
56 | #endif /* __STDC__ */ | |
57 | ||
58 | extern args_type command_line; | |
59 | char *current_file; | |
60 | boolean ldgram_want_filename = true; | |
61 | boolean had_script = false; | |
62 | boolean force_make_executable = false; | |
1d45ccb3 | 63 | |
1418c83b | 64 | boolean ldgram_in_script = false; |
1d45ccb3 | 65 | boolean ldgram_had_equals = false; |
2fa0b342 DHW |
66 | /* LOCALS */ |
67 | ||
68 | ||
69 | ||
70 | ||
71 | %} | |
72 | %union { | |
73 | bfd_vma integer; | |
74 | int voidval; | |
75 | char *name; | |
76 | int token; | |
77 | union etree_union *etree; | |
78 | asection *section; | |
79 | struct lang_output_section_statement_struct *output_section_statement; | |
80 | union lang_statement_union **statement_ptr; | |
81 | int lineno; | |
82 | struct { | |
83 | FILE *file; | |
84 | char *name; | |
85 | unsigned int lineno; | |
86 | } state; | |
87 | ||
88 | ||
89 | } | |
90 | ||
6812f0e8 | 91 | %type <etree> exp opt_exp |
2fa0b342 DHW |
92 | %type <integer> fill_opt opt_block |
93 | %type <name> memspec_opt | |
6812f0e8 | 94 | %token <integer> INT |
2fa0b342 DHW |
95 | %token <name> NAME |
96 | %type <integer> length | |
97 | ||
a37cc0c0 | 98 | %right <token> PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ |
2fa0b342 DHW |
99 | %right <token> '?' ':' |
100 | %left <token> OROR | |
101 | %left <token> ANDAND | |
102 | %left <token> '|' | |
103 | %left <token> '^' | |
104 | %left <token> '&' | |
105 | %left <token> EQ NE | |
106 | %left <token> '<' '>' LE GE | |
107 | %left <token> LSHIFT RSHIFT | |
6812f0e8 | 108 | |
2fa0b342 DHW |
109 | %left <token> '+' '-' |
110 | %left <token> '*' '/' '%' | |
6812f0e8 SC |
111 | |
112 | /*%token <token> '+' '-' '*' '/' '%'*/ | |
2fa0b342 DHW |
113 | %right UNARY |
114 | %left <token> '(' | |
115 | %token <token> ALIGN_K BLOCK LONG SHORT BYTE | |
116 | %token SECTIONS | |
117 | %token '{' '}' | |
6812f0e8 SC |
118 | %token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH |
119 | %token SIZEOF_HEADERS | |
2fa0b342 | 120 | %token MEMORY |
2fa0b342 | 121 | %token NAME DEFINED TARGET_K SEARCH_DIR MAP ENTRY |
b6316534 | 122 | %token OPTION_e OPTION_c OPTION_noinhibit_exec OPTION_s OPTION_S OPTION_sort_common |
1418c83b | 123 | %token OPTION_format OPTION_F OPTION_u |
6812f0e8 | 124 | %token <integer> SIZEOF NEXT ADDR |
a37cc0c0 SC |
125 | %token OPTION_d OPTION_dc OPTION_dp OPTION_x OPTION_X OPTION_defsym |
126 | %token OPTION_v OPTION_M OPTION_t STARTUP HLL SYSLIB FLOAT NOFLOAT | |
6812f0e8 | 127 | %token OPTION_n OPTION_r OPTION_o OPTION_b OPTION_R |
2fa0b342 DHW |
128 | %token <name> OPTION_l OPTION_L OPTION_T OPTION_Aarch OPTION_Tfile OPTION_Texp |
129 | %token OPTION_Ur | |
130 | %token ORIGIN FILL OPTION_g | |
6812f0e8 SC |
131 | %token LENGTH CREATE_OBJECT_SYMBOLS INPUT OUTPUT |
132 | %type <token> assign_op | |
133 | ||
2fa0b342 DHW |
134 | %type <name> filename |
135 | ||
136 | %{ | |
137 | ld_config_type config; | |
138 | %} | |
139 | ||
140 | %% | |
141 | ||
142 | ||
143 | ||
144 | file: command_line { lang_final(); }; | |
145 | ||
146 | ||
147 | filename: | |
7ca04d28 | 148 | NAME; |
2fa0b342 DHW |
149 | |
150 | command_line: | |
151 | command_line command_line_option | |
152 | | | |
153 | ; | |
154 | ||
155 | command_line_option: | |
a37cc0c0 | 156 | '{' |
ac004870 SC |
157 | { ldgram_in_script = true; } |
158 | ifile_list | |
159 | { ldgram_in_script = false; } | |
a37cc0c0 | 160 | '}' |
1418c83b | 161 | | OPTION_v |
2fa0b342 DHW |
162 | { |
163 | ldversion(); | |
164 | option_v = true; | |
165 | } | |
166 | | OPTION_t { | |
167 | trace_files = true; | |
168 | } | |
169 | | OPTION_M { | |
170 | write_map = true; | |
171 | } | |
172 | | OPTION_n { | |
173 | config.magic_demand_paged = false; | |
174 | config.make_executable = false; | |
175 | } | |
176 | | OPTION_s { | |
177 | strip_symbols = STRIP_ALL; | |
178 | } | |
179 | | OPTION_S { | |
180 | strip_symbols = STRIP_DEBUGGER; | |
181 | } | |
1418c83b SC |
182 | | OPTION_u NAME { |
183 | ldlang_add_undef($2); | |
184 | } | |
185 | ||
2fa0b342 DHW |
186 | | OPTION_r { |
187 | config.relocateable_output = true; | |
188 | config.build_constructors = false; | |
189 | config.magic_demand_paged = false; | |
190 | } | |
191 | | OPTION_Ur { | |
192 | config.relocateable_output = true; | |
193 | config.build_constructors = true; | |
194 | config.magic_demand_paged = false; | |
195 | } | |
196 | | OPTION_o filename | |
197 | { | |
198 | lang_add_output($2); | |
199 | } | |
200 | | OPTION_e NAME | |
201 | { lang_add_entry($2); | |
202 | } | |
203 | | OPTION_X { | |
204 | discard_locals = DISCARD_L; | |
205 | } | |
206 | | OPTION_x { | |
207 | discard_locals = DISCARD_ALL; | |
208 | } | |
209 | ||
210 | | OPTION_noinhibit_exec | |
211 | { | |
212 | force_make_executable = true; | |
213 | } | |
b6316534 SC |
214 | | OPTION_sort_common { |
215 | config.sort_common = true; | |
216 | } | |
1418c83b | 217 | | OPTION_d { |
2fa0b342 DHW |
218 | command_line.force_common_definition = true; |
219 | } | |
1418c83b | 220 | | OPTION_dc |
2fa0b342 DHW |
221 | { |
222 | command_line.force_common_definition = true; | |
223 | } | |
224 | | OPTION_g | |
225 | { | |
226 | /* Ignored */ | |
227 | } | |
1418c83b | 228 | | OPTION_dp |
2fa0b342 DHW |
229 | { |
230 | command_line.force_common_definition = true; | |
231 | } | |
1418c83b | 232 | | OPTION_format NAME |
7ca04d28 SC |
233 | { |
234 | lang_add_target($2); | |
235 | } | |
de7c1ff6 | 236 | | OPTION_Texp |
1418c83b SC |
237 | { |
238 | hex_mode =true; | |
239 | } | |
240 | INT | |
241 | { | |
242 | lang_section_start($1,exp_intop($3)); | |
243 | hex_mode = false; | |
244 | } | |
2fa0b342 | 245 | |
7ca04d28 | 246 | | OPTION_Aarch |
1418c83b SC |
247 | { |
248 | ldfile_add_arch($1); | |
249 | } | |
7ca04d28 | 250 | | OPTION_b NAME |
2fa0b342 DHW |
251 | { |
252 | lang_add_target($2); | |
253 | } | |
254 | | OPTION_L | |
255 | { | |
256 | ldfile_add_library_path($1); | |
1418c83b | 257 | } |
7ca04d28 SC |
258 | | OPTION_F |
259 | { | |
260 | /* Ignore */ | |
261 | } | |
1418c83b SC |
262 | | NAME |
263 | { lang_add_input_file($1,lang_input_file_is_file_enum, | |
264 | (char *)NULL); } | |
265 | | OPTION_c filename script_file | |
2fa0b342 | 266 | { ldfile_open_command_file($2); } |
1418c83b SC |
267 | | OPTION_Tfile |
268 | { ldfile_open_command_file($1); } script_file | |
2fa0b342 | 269 | |
1418c83b SC |
270 | | OPTION_T filename |
271 | { ldfile_open_command_file($2); } script_file | |
2fa0b342 DHW |
272 | |
273 | | OPTION_l | |
274 | { | |
275 | lang_add_input_file($1, | |
276 | lang_input_file_is_l_enum, | |
277 | (char *)NULL); | |
278 | } | |
1418c83b | 279 | | OPTION_R filename |
2fa0b342 DHW |
280 | { |
281 | lang_add_input_file($2, | |
282 | lang_input_file_is_symbols_only_enum, | |
283 | (char *)NULL); | |
284 | } | |
7ca04d28 SC |
285 | | OPTION_defsym |
286 | { | |
7ca04d28 | 287 | } |
1d45ccb3 | 288 | NAME '=' |
6812f0e8 | 289 | exp |
7ca04d28 | 290 | { |
1d45ccb3 | 291 | lang_add_assignment(exp_assop($4,$3,$5)); |
7ca04d28 | 292 | } |
1418c83b SC |
293 | | '-' NAME |
294 | { info("%P%F Unrecognised option -%s\n", $2); } | |
7ca04d28 | 295 | |
2fa0b342 DHW |
296 | ; |
297 | ||
298 | ||
1418c83b | 299 | |
2fa0b342 DHW |
300 | |
301 | ||
302 | ||
1418c83b SC |
303 | |
304 | ||
305 | script_file: | |
306 | { ldgram_in_script = true; } | |
a37cc0c0 | 307 | ifile_list '}' |
1418c83b SC |
308 | { ldgram_in_script = false; } |
309 | ||
310 | ; | |
311 | ||
312 | ||
313 | ifile_list: | |
314 | ifile_list ifile_p1 | |
13a0e8d7 | 315 | | |
2fa0b342 DHW |
316 | ; |
317 | ||
318 | ||
319 | ||
320 | ifile_p1: | |
321 | memory | |
322 | | sections | |
323 | | startup | |
324 | | high_level_library | |
325 | | low_level_library | |
326 | | floating_point_support | |
ac004870 | 327 | | statement_anywhere |
2fa0b342 DHW |
328 | | TARGET_K '(' NAME ')' |
329 | { lang_add_target($3); } | |
330 | | SEARCH_DIR '(' filename ')' | |
331 | { ldfile_add_library_path($3); } | |
332 | | OUTPUT '(' filename ')' | |
333 | { lang_add_output($3); } | |
13a0e8d7 SC |
334 | | OUTPUT_FORMAT '(' NAME ')' |
335 | { lang_add_output_format($3); } | |
a37cc0c0 SC |
336 | | OUTPUT_ARCH '(' NAME ')' |
337 | { ldfile_set_output_arch($3); } | |
13a0e8d7 SC |
338 | | FORCE_COMMON_ALLOCATION |
339 | { command_line.force_common_definition = true ; } | |
2fa0b342 DHW |
340 | | INPUT '(' input_list ')' |
341 | | MAP '(' filename ')' | |
342 | { lang_add_map($3); } | |
343 | ; | |
344 | ||
345 | input_list: | |
346 | NAME | |
347 | { lang_add_input_file($1,lang_input_file_is_file_enum, | |
348 | (char *)NULL); } | |
349 | | input_list ',' NAME | |
350 | { lang_add_input_file($3,lang_input_file_is_file_enum, | |
351 | (char *)NULL); } | |
352 | | input_list NAME | |
353 | { lang_add_input_file($2, lang_input_file_is_file_enum, | |
354 | (char *)NULL); } | |
355 | ; | |
356 | ||
357 | sections: | |
358 | SECTIONS '{'sec_or_group_p1 '}' | |
359 | ; | |
360 | ||
361 | sec_or_group_p1: | |
362 | sec_or_group_p1 section | |
363 | | sec_or_group_p1 statement_anywhere | |
364 | | | |
365 | ; | |
366 | ||
367 | statement_anywhere: | |
368 | ENTRY '(' NAME ')' | |
369 | { lang_add_entry($3); } | |
370 | | assignment end | |
371 | ; | |
372 | ||
1418c83b SC |
373 | file_NAME_list: |
374 | NAME | |
375 | { lang_add_wild($1, current_file); } | |
376 | | file_NAME_list opt_comma NAME | |
377 | { lang_add_wild($3, current_file); } | |
378 | ; | |
379 | ||
380 | input_section_spec: | |
381 | NAME | |
382 | { | |
383 | lang_add_wild((char *)NULL, $1); | |
384 | } | |
385 | | '[' | |
386 | { | |
387 | current_file = (char *)NULL; | |
388 | } | |
389 | file_NAME_list | |
390 | ']' | |
391 | | NAME | |
392 | { | |
393 | current_file =$1; | |
394 | } | |
395 | '(' file_NAME_list ')' | |
396 | | '*' | |
397 | { | |
398 | current_file = (char *)NULL; | |
399 | } | |
400 | '(' file_NAME_list ')' | |
401 | ; | |
402 | ||
2fa0b342 DHW |
403 | statement: |
404 | statement assignment end | |
405 | | statement CREATE_OBJECT_SYMBOLS | |
13a0e8d7 SC |
406 | { |
407 | lang_add_attribute(lang_object_symbols_statement_enum); } | |
408 | ||
2fa0b342 | 409 | | statement input_section_spec |
6812f0e8 | 410 | | statement length '(' exp ')' |
2fa0b342 DHW |
411 | { |
412 | lang_add_data($2,$4); | |
413 | } | |
414 | ||
6812f0e8 | 415 | | statement FILL '(' exp ')' |
2fa0b342 DHW |
416 | { |
417 | lang_add_fill | |
418 | (exp_get_value_int($4, | |
419 | 0, | |
420 | "fill value", | |
421 | lang_first_phase_enum)); | |
422 | } | |
423 | | | |
424 | ; | |
425 | ||
426 | length: | |
427 | LONG | |
428 | { $$ = $1; } | |
429 | | SHORT | |
430 | { $$ = $1; } | |
431 | | BYTE | |
432 | { $$ = $1; } | |
433 | ; | |
434 | ||
435 | fill_opt: | |
6812f0e8 | 436 | '=' exp |
2fa0b342 DHW |
437 | { |
438 | $$ = exp_get_value_int($2, | |
439 | 0, | |
440 | "fill value", | |
441 | lang_first_phase_enum); | |
442 | } | |
443 | | { $$ = 0; } | |
444 | ; | |
445 | ||
446 | ||
447 | ||
448 | assign_op: | |
449 | PLUSEQ | |
450 | { $$ = '+'; } | |
451 | | MINUSEQ | |
452 | { $$ = '-'; } | |
453 | | MULTEQ | |
454 | { $$ = '*'; } | |
455 | | DIVEQ | |
456 | { $$ = '/'; } | |
457 | | LSHIFTEQ | |
458 | { $$ = LSHIFT; } | |
459 | | RSHIFTEQ | |
460 | { $$ = RSHIFT; } | |
461 | | ANDEQ | |
462 | { $$ = '&'; } | |
463 | | OREQ | |
464 | { $$ = '|'; } | |
465 | ||
466 | ; | |
467 | ||
468 | end: ';' | ',' | |
469 | ; | |
470 | ||
2fa0b342 DHW |
471 | |
472 | assignment: | |
6812f0e8 | 473 | NAME '=' exp |
2fa0b342 DHW |
474 | { |
475 | lang_add_assignment(exp_assop($2,$1,$3)); | |
476 | } | |
6812f0e8 | 477 | | NAME assign_op exp |
2fa0b342 DHW |
478 | { |
479 | lang_add_assignment(exp_assop('=',$1,exp_binop($2,exp_nameop(NAME,$1),$3))); | |
480 | } | |
481 | ||
482 | ; | |
483 | ||
484 | ||
485 | opt_comma: | |
486 | ',' | ; | |
487 | ||
488 | ||
489 | memory: | |
490 | MEMORY '{' memory_spec memory_spec_list '}' | |
491 | ; | |
492 | ||
493 | memory_spec_list: | |
494 | memory_spec_list memory_spec | |
495 | | memory_spec_list ',' memory_spec | |
496 | | | |
497 | ; | |
498 | ||
499 | ||
500 | memory_spec: | |
501 | NAME | |
502 | { region = lang_memory_region_lookup($1); } | |
503 | attributes_opt ':' origin_spec opt_comma length_spec | |
504 | ||
505 | { | |
506 | ||
507 | ||
508 | } | |
509 | ; | |
510 | origin_spec: | |
511 | ORIGIN '=' exp | |
512 | { region->current = | |
513 | region->origin = | |
514 | exp_get_vma($3, 0L,"origin", lang_first_phase_enum); } | |
515 | ; | |
516 | length_spec: | |
517 | LENGTH '=' exp | |
518 | { region->length = exp_get_vma($3, | |
519 | ~((bfd_vma)0), | |
520 | "length", | |
521 | lang_first_phase_enum); | |
522 | } | |
523 | ||
524 | ||
525 | attributes_opt: | |
526 | '(' NAME ')' | |
527 | { | |
528 | lang_set_flags(®ion->flags, $2); | |
529 | } | |
530 | | | |
531 | ||
532 | ; | |
533 | ||
534 | startup: | |
535 | STARTUP '(' filename ')' | |
536 | { lang_startup($3); } | |
537 | ; | |
538 | ||
539 | high_level_library: | |
540 | HLL '(' high_level_library_NAME_list ')' | |
541 | | HLL '(' ')' | |
542 | { ldemul_hll((char *)NULL); } | |
543 | ; | |
544 | ||
545 | high_level_library_NAME_list: | |
546 | high_level_library_NAME_list opt_comma filename | |
547 | { ldemul_hll($3); } | |
548 | | filename | |
549 | { ldemul_hll($1); } | |
550 | ||
551 | ; | |
552 | ||
553 | low_level_library: | |
554 | SYSLIB '(' low_level_library_NAME_list ')' | |
555 | ; | |
556 | low_level_library_NAME_list: | |
557 | low_level_library_NAME_list opt_comma filename | |
558 | { ldemul_syslib($3); } | |
559 | | | |
560 | ; | |
561 | ||
562 | floating_point_support: | |
563 | FLOAT | |
564 | { lang_float(true); } | |
565 | | NOFLOAT | |
566 | { lang_float(false); } | |
567 | ; | |
568 | ||
569 | ||
570 | ||
571 | ||
572 | exp : | |
573 | '-' exp %prec UNARY | |
574 | { $$ = exp_unop('-', $2); } | |
575 | | '(' exp ')' | |
576 | { $$ = $2; } | |
577 | | NEXT '(' exp ')' %prec UNARY | |
578 | { $$ = exp_unop($1,$3); } | |
579 | | '!' exp %prec UNARY | |
580 | { $$ = exp_unop('!', $2); } | |
581 | | '+' exp %prec UNARY | |
582 | { $$ = $2; } | |
583 | | '~' exp %prec UNARY | |
584 | { $$ = exp_unop('~', $2);} | |
585 | ||
586 | | exp '*' exp | |
587 | { $$ = exp_binop('*', $1, $3); } | |
588 | | exp '/' exp | |
589 | { $$ = exp_binop('/', $1, $3); } | |
590 | | exp '%' exp | |
591 | { $$ = exp_binop('%', $1, $3); } | |
592 | | exp '+' exp | |
593 | { $$ = exp_binop('+', $1, $3); } | |
594 | | exp '-' exp | |
595 | { $$ = exp_binop('-' , $1, $3); } | |
596 | | exp LSHIFT exp | |
597 | { $$ = exp_binop(LSHIFT , $1, $3); } | |
598 | | exp RSHIFT exp | |
599 | { $$ = exp_binop(RSHIFT , $1, $3); } | |
600 | | exp EQ exp | |
601 | { $$ = exp_binop(EQ , $1, $3); } | |
602 | | exp NE exp | |
603 | { $$ = exp_binop(NE , $1, $3); } | |
604 | | exp LE exp | |
605 | { $$ = exp_binop(LE , $1, $3); } | |
606 | | exp GE exp | |
607 | { $$ = exp_binop(GE , $1, $3); } | |
608 | | exp '<' exp | |
609 | { $$ = exp_binop('<' , $1, $3); } | |
610 | | exp '>' exp | |
611 | { $$ = exp_binop('>' , $1, $3); } | |
612 | | exp '&' exp | |
613 | { $$ = exp_binop('&' , $1, $3); } | |
614 | | exp '^' exp | |
615 | { $$ = exp_binop('^' , $1, $3); } | |
616 | | exp '|' exp | |
617 | { $$ = exp_binop('|' , $1, $3); } | |
618 | | exp '?' exp ':' exp | |
619 | { $$ = exp_trinop('?' , $1, $3, $5); } | |
620 | | exp ANDAND exp | |
621 | { $$ = exp_binop(ANDAND , $1, $3); } | |
622 | | exp OROR exp | |
623 | { $$ = exp_binop(OROR , $1, $3); } | |
624 | | DEFINED '(' NAME ')' | |
625 | { $$ = exp_nameop(DEFINED, $3); } | |
626 | | INT | |
627 | { $$ = exp_intop($1); } | |
65c552e3 SC |
628 | | SIZEOF_HEADERS |
629 | { $$ = exp_nameop(SIZEOF_HEADERS,0); } | |
2fa0b342 DHW |
630 | |
631 | | SIZEOF '(' NAME ')' | |
632 | { $$ = exp_nameop($1,$3); } | |
633 | | ADDR '(' NAME ')' | |
634 | { $$ = exp_nameop($1,$3); } | |
635 | | ALIGN_K '(' exp ')' | |
636 | { $$ = exp_unop($1,$3); } | |
637 | | NAME | |
638 | { $$ = exp_nameop(NAME,$1); } | |
639 | ; | |
640 | ||
641 | ||
642 | ||
643 | ||
644 | section: NAME opt_exp opt_block ':' opt_things'{' | |
645 | { | |
646 | lang_enter_output_section_statement($1,$2,$3); | |
647 | } | |
648 | statement '}' fill_opt memspec_opt | |
649 | { | |
650 | lang_leave_output_section_statement($10, $11); | |
651 | } | |
652 | ||
653 | ; | |
654 | ||
655 | opt_things: | |
656 | { | |
657 | ||
658 | } | |
659 | ; | |
660 | ||
6812f0e8 SC |
661 | |
662 | ||
663 | ||
2fa0b342 DHW |
664 | |
665 | opt_exp: | |
6812f0e8 | 666 | exp |
2fa0b342 DHW |
667 | { $$ = $1; } |
668 | | { $$= (etree_type *)NULL; } | |
669 | ; | |
670 | ||
671 | opt_block: | |
6812f0e8 | 672 | BLOCK '(' exp ')' |
2fa0b342 DHW |
673 | { $$ = exp_get_value_int($3, |
674 | 1L, | |
675 | "block", | |
676 | lang_first_phase_enum); | |
677 | } | |
678 | | { $$ = 1; } | |
679 | ; | |
680 | ||
681 | memspec_opt: | |
682 | '>' NAME | |
683 | { $$ = $2; } | |
684 | | { $$ = "*default*"; } | |
685 | ; | |
686 |