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