Made many changes to eliminate gcc warnings. Made various
[deliverable/binutils-gdb.git] / ld / ldgram.y
1 /* A YACC grammer to parse a superset of the AT&T linker scripting languaue.
2 Copyright (C) 1991 Free Software Foundation, Inc.
3 Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
4
5 This file is part of GNU ld.
6
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
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
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.
16
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
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
20
21 %{
22 /*
23
24 */
25
26 #define DONTDECLARE_MALLOC
27
28 #include "bfd.h"
29 #include "sysdep.h"
30 #include "ld.h"
31 #include "ldexp.h"
32 #include "ldver.h"
33 #include "ldlang.h"
34 #include "ldemul.h"
35 #include "ldfile.h"
36 #include "ldmisc.h"
37 #include "ldsym.h"
38 #include "ldmain.h"
39 #include "mri.h"
40 #include "ldlex.h"
41
42 #define YYDEBUG 1
43
44 static int typebits;
45 strip_symbols_type strip_symbols=STRIP_NONE;
46 discard_locals_type discard_locals=DISCARD_NONE;
47
48 static char *dirlist_ptr;
49
50 lang_memory_region_type *region;
51
52
53 char *current_file;
54 boolean ldgram_want_filename = true;
55 boolean had_script = false;
56 boolean force_make_executable = false;
57
58 boolean ldgram_in_script = false;
59 boolean ldgram_had_equals = false;
60
61
62 #define ERROR_NAME_MAX 20
63 static char *error_names[ERROR_NAME_MAX];
64 static int error_index;
65 #define PUSH_ERROR(x) if (error_index < ERROR_NAME_MAX) error_names[error_index] = x; error_index++;
66 #define POP_ERROR() error_index--;
67 %}
68 %union {
69 bfd_vma integer;
70 int voidval;
71 char *name;
72 int token;
73 union etree_union *etree;
74 struct sec *section;
75 struct lang_output_section_statement_struct *output_section_statement;
76 union lang_statement_union **statement_ptr;
77 int lineno;
78 struct {
79 FILE *file;
80 char *name;
81 unsigned int lineno;
82 } state;
83
84
85 }
86
87 %type <etree> exp opt_exp_with_type mustbe_exp opt_at
88 %type <integer> fill_opt
89 %type <name> memspec_opt
90 %token <integer> INT
91 %token <name> NAME
92 %type <integer> length
93
94 %right <token> PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ
95 %right <token> '?' ':'
96 %left <token> OROR
97 %left <token> ANDAND
98 %left <token> '|'
99 %left <token> '^'
100 %left <token> '&'
101 %left <token> EQ NE
102 %left <token> '<' '>' LE GE
103 %left <token> LSHIFT RSHIFT
104
105 %left <token> '+' '-'
106 %left <token> '*' '/' '%'
107
108 /*%token <token> '+' '-' '*' '/' '%'*/
109 %right UNARY
110 %token END
111 %left <token> '('
112 %token <token> ALIGN_K BLOCK LONG SHORT BYTE
113 %token SECTIONS
114 %token '{' '}'
115 %token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH
116 %token SIZEOF_HEADERS
117 %token INCLUDE
118 %token MEMORY DEFSYMEND
119 %token NOLOAD DSECT COPY INFO OVERLAY
120 %token NAME DEFINED TARGET_K SEARCH_DIR MAP ENTRY
121 %token OPTION_e OPTION_c OPTION_noinhibit_exec OPTION_s OPTION_S OPTION_sort_common OPTION_warn_common
122 %token OPTION_EB OPTION_EL OPTION_G OPTION_Gval OPTION_help
123 %token OPTION_format OPTION_oformat OPTION_F OPTION_u OPTION_Bstatic OPTION_N
124 %token <integer> SIZEOF NEXT ADDR
125 %token OPTION_d OPTION_dc OPTION_dp OPTION_x OPTION_X OPTION_defsym
126 %token OPTION_v OPTION_V OPTION_m OPTION_memul OPTION_M OPTION_t STARTUP HLL SYSLIB FLOAT NOFLOAT
127 %token OPTION_L OPTION_Map
128 %token OPTION_n OPTION_r OPTION_o OPTION_b OPTION_R OPTION_relax OPTION_version
129 %token <name> OPTION_l OPTION_Lfile OPTION_T OPTION_Aarch OPTION_Tfile
130 %token <name> OPTION_Texp OPTION_y
131 %token OPTION_Ur
132 %token ORIGIN FILL OPTION_g
133 %token LENGTH CREATE_OBJECT_SYMBOLS INPUT OUTPUT CONSTRUCTORS
134 %token OPTION_RETAIN_SYMBOLS_FILE ALIGNMOD AT
135 %token OPTION_Qy OPTION_Y OPTION_dn OPTION_call_shared OPTION_non_shared
136 %token OPTION_Oval
137 %token <name> OPTION_YP
138
139 %type <token> assign_op
140
141 %type <name> filename
142
143
144 %token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD
145 %token FORMAT PUBLIC DEFSYMEND BASE ALIAS TRUNCATE
146
147 %%
148
149 file: command_line { lang_final(); };
150
151
152 filename: NAME;
153
154
155 command_line:
156 command_line command_line_option
157 |
158 ;
159
160 command_line_option:
161 OPTION_Bstatic { }
162 | OPTION_help
163 {
164 help ();
165 exit (0);
166 }
167 | OPTION_v
168 {
169 ldversion(0);
170 }
171 | OPTION_V
172 {
173 ldversion(1);
174 trace_file_tries = true;
175 }
176 | OPTION_version
177 {
178 ldversion(0);
179 exit(0);
180 }
181 | OPTION_t {
182 trace_files = true;
183 }
184 | OPTION_Map NAME
185 {
186 write_map = true;
187 config.map_filename = $2;
188 }
189 | OPTION_m NAME
190 {
191 /* Ignore. */
192 }
193 | OPTION_memul
194 {
195 /* Ignore. */
196 }
197 | OPTION_M
198 {
199 config.map_filename = "-";
200 }
201 | OPTION_n {
202 config.magic_demand_paged = false;
203 }
204 | OPTION_N {
205 config.text_read_only = false;
206 config.magic_demand_paged = false;
207 }
208 | OPTION_s {
209 strip_symbols = STRIP_ALL;
210 }
211 | OPTION_S {
212 strip_symbols = STRIP_DEBUGGER;
213 }
214 | OPTION_u NAME {
215 ldlang_add_undef($2);
216 }
217
218 | OPTION_r {
219 config.relocateable_output = true;
220 config.build_constructors = false;
221 config.magic_demand_paged = false;
222 config.text_read_only = false;
223 }
224 | OPTION_Ur {
225 config.relocateable_output = true;
226 config.build_constructors = true;
227 config.magic_demand_paged = false;
228 config.text_read_only = false;
229 }
230 | OPTION_o filename
231 {
232 lang_add_output($2, 0);
233 }
234 | OPTION_e NAME
235 { lang_add_entry($2);
236 }
237 | OPTION_X {
238 discard_locals = DISCARD_L;
239 }
240 | OPTION_x {
241 discard_locals = DISCARD_ALL;
242 }
243
244 | OPTION_noinhibit_exec
245 {
246 force_make_executable = true;
247 }
248 | OPTION_sort_common
249 {
250 config.sort_common = true;
251 }
252 | OPTION_warn_common
253 {
254 config.warn_common = true;
255 }
256 | OPTION_d {
257 command_line.force_common_definition = true;
258 }
259
260 | OPTION_relax {
261 command_line.relax = true;
262 }
263 | OPTION_dc
264 {
265 command_line.force_common_definition = true;
266 }
267 | OPTION_g
268 {
269 /* Ignored */
270 }
271 | OPTION_dp
272 {
273 command_line.force_common_definition = true;
274 }
275 | OPTION_format NAME
276 {
277 lang_add_target($2);
278 }
279 | OPTION_oformat NAME
280 {
281 lang_add_output_format($2, 0);
282 }
283 | OPTION_Texp
284 { ldlex_expression();
285 hex_mode = 16;
286 }
287 INT
288 { ldlex_popstate();
289 lang_section_start($1,exp_intop($3));
290 hex_mode = 0;
291 }
292 | OPTION_y
293 {
294 add_ysym($1);
295 }
296 | OPTION_Aarch
297 {
298 ldfile_add_arch($1);
299 }
300 | OPTION_b NAME
301 {
302 lang_add_target($2);
303 }
304 | OPTION_L NAME
305 {
306 ldfile_add_library_path($2);
307 }
308 | OPTION_Lfile
309 {
310 ldfile_add_library_path($1);
311 }
312 | OPTION_F
313 {
314 /* Ignore */
315 }
316 | OPTION_c filename
317 {ldfile_open_command_file($2); }
318 mri_script_file END { ldlex_command();}
319
320 | OPTION_Tfile
321 { ldfile_open_command_file($1); } script_file
322 END { ldlex_command();}
323
324 | OPTION_T filename
325 { ldfile_open_command_file($2); } script_file
326 END { ldlex_command();}
327
328 | OPTION_l
329 {
330 lang_add_input_file($1,
331 lang_input_file_is_l_enum,
332 (char *)NULL);
333 }
334 | OPTION_R filename
335 {
336 lang_add_input_file($2,
337 lang_input_file_is_symbols_only_enum,
338 (char *)NULL);
339 }
340
341 | OPTION_defsym { ldlex_defsym(); }
342 NAME '=' exp DEFSYMEND { ldlex_popstate();
343 lang_add_assignment(exp_assop($4,$3,$5));
344 }
345 | OPTION_RETAIN_SYMBOLS_FILE filename
346 { lang_add_keepsyms_file ($2); }
347 | OPTION_EB
348 {
349 /* FIXME: This is currently ignored. It means
350 ``produce a big-endian object file''. It could
351 be used to select an output format. */
352 }
353 | OPTION_EL
354 {
355 /* FIXME: This is currently ignored. It means
356 ``produce a little-endian object file''. It could
357 be used to select an output format. */
358 }
359 | OPTION_G NAME
360 {
361 g_switch_value = atoi ($2);
362 }
363 | OPTION_Gval
364 {
365 g_switch_value = yylval.integer;
366 }
367 | OPTION_Qy
368 | OPTION_dn
369 | OPTION_non_shared
370 | OPTION_call_shared
371 | OPTION_Oval
372 | OPTION_YP
373 {
374 dirlist_ptr = $1;
375 goto set_default_dirlist;
376 }
377 | OPTION_Y NAME
378 {
379 if (strncmp ($2, "P,", 2))
380 einfo ("%P%F: unknown -Y option -- %s\n", $2);
381 else
382 {
383 char *p = "";
384 dirlist_ptr = $2;
385 set_default_dirlist:
386 while (p != 0)
387 {
388 p = strchr (dirlist_ptr, ':');
389 if (p)
390 *p = 0;
391 if (*dirlist_ptr)
392 ldfile_add_library_path (dirlist_ptr);
393 if (p)
394 {
395 *p = ':';
396 dirlist_ptr = p + 1;
397 }
398 }
399 }
400 }
401 | '{' script_file '}' { /* This parses compiled-in scripts. */ }
402 | NAME
403 {
404 if (*$1 == '-')
405 einfo("%P%F: illegal option -- %s\n", $1);
406 else
407 lang_add_input_file($1,lang_input_file_is_file_enum,
408 (char *)NULL);
409 }
410 ;
411
412
413 /* SYNTAX WITHIN AN MRI SCRIPT FILE */
414 mri_script_file:
415 { ldlex_mri_script();
416 PUSH_ERROR("MRI style script");
417 }
418 mri_script_lines
419 { ldlex_popstate();
420 POP_ERROR();
421 }
422 ;
423
424 mri_script_lines:
425 mri_script_lines mri_script_command NEWLINE
426 |
427 ;
428
429 mri_script_command:
430 CHIP exp
431 | CHIP exp ',' exp
432 | NAME {
433 einfo("%P%F: unrecognised keyword in MRI style script '%s'\n",$1);
434 }
435 | LIST {
436 write_map = true;
437 config.map_filename = "-";
438 }
439 | ORDER ordernamelist
440 | ENDWORD
441 | PUBLIC NAME '=' exp
442 { mri_public($2, $4); }
443 | PUBLIC NAME ',' exp
444 { mri_public($2, $4); }
445 | PUBLIC NAME exp
446 { mri_public($2, $3); }
447 | FORMAT NAME
448 { mri_format($2); }
449 | SECT NAME ',' exp
450 { mri_output_section($2, $4);}
451 | SECT NAME exp
452 { mri_output_section($2, $3);}
453 | SECT NAME '=' exp
454 { mri_output_section($2, $4);}
455 | ALIGN_K NAME '=' exp
456 { mri_align($2,$4); }
457 | ALIGNMOD NAME '=' exp
458 { mri_alignmod($2,$4); }
459 | ABSOLUTE mri_abs_name_list
460 | LOAD mri_load_name_list
461 | NAMEWORD NAME
462 { mri_name($2); }
463 | ALIAS NAME ',' NAME
464 { mri_alias($2,$4,0);}
465 | ALIAS NAME ',' INT
466 { mri_alias($2,0,$4);}
467 | BASE exp
468 { mri_base($2); }
469 | TRUNCATE INT
470 { mri_truncate($2); }
471 |
472 ;
473
474 ordernamelist:
475 ordernamelist ',' NAME { mri_order($3); }
476 | ordernamelist NAME { mri_order($2); }
477 |
478 ;
479
480 mri_load_name_list:
481 NAME
482 { mri_load($1); }
483 | mri_load_name_list ',' NAME { mri_load($3); }
484 ;
485
486 mri_abs_name_list:
487 NAME
488 { mri_only_load($1); }
489 | mri_abs_name_list ',' NAME
490 { mri_only_load($3); }
491 ;
492
493 script_file:
494 {
495 ldlex_both();
496 }
497 ifile_list
498 {
499 ldlex_popstate();
500 }
501 ;
502
503
504 ifile_list:
505 ifile_list ifile_p1
506 |
507 ;
508
509
510
511 ifile_p1:
512 memory
513 | sections
514 | startup
515 | high_level_library
516 | low_level_library
517 | floating_point_support
518 | statement_anywhere
519 | ';'
520 | TARGET_K '(' NAME ')'
521 { lang_add_target($3); }
522 | SEARCH_DIR '(' filename ')'
523 { ldfile_add_library_path($3); }
524 | OUTPUT '(' filename ')'
525 { lang_add_output($3, 1); }
526 | OUTPUT_FORMAT '(' NAME ')'
527 { lang_add_output_format($3, 1); }
528 | OUTPUT_ARCH '(' NAME ')'
529 { ldfile_set_output_arch($3); }
530 | FORCE_COMMON_ALLOCATION
531 { command_line.force_common_definition = true ; }
532 | INPUT '(' input_list ')'
533 | MAP '(' filename ')'
534 { lang_add_map($3); }
535 | INCLUDE filename
536 { ldfile_open_command_file($2); } ifile_list END
537 ;
538
539 input_list:
540 NAME
541 { lang_add_input_file($1,lang_input_file_is_search_file_enum,
542 (char *)NULL); }
543 | input_list ',' NAME
544 { lang_add_input_file($3,lang_input_file_is_search_file_enum,
545 (char *)NULL); }
546 | input_list NAME
547 { lang_add_input_file($2,lang_input_file_is_search_file_enum,
548 (char *)NULL); }
549 ;
550
551 sections:
552 SECTIONS '{' sec_or_group_p1 '}'
553 ;
554
555 sec_or_group_p1:
556 sec_or_group_p1 section
557 | sec_or_group_p1 statement_anywhere
558 |
559 ;
560
561 statement_anywhere:
562 ENTRY '(' NAME ')'
563 { lang_add_entry($3); }
564 | assignment end
565 ;
566
567 file_NAME_list:
568 NAME
569 { lang_add_wild($1, current_file); }
570 | file_NAME_list opt_comma NAME
571 { lang_add_wild($3, current_file); }
572 ;
573
574 input_section_spec:
575 NAME
576 {
577 lang_add_wild((char *)NULL, $1);
578 }
579 | '['
580 {
581 current_file = (char *)NULL;
582 }
583 file_NAME_list
584 ']'
585 | NAME
586 {
587 current_file =$1;
588 }
589 '(' file_NAME_list ')'
590 | '*'
591 {
592 current_file = (char *)NULL;
593 }
594 '(' file_NAME_list ')'
595 ;
596
597 statement:
598 assignment end
599 | CREATE_OBJECT_SYMBOLS
600 {
601 lang_add_attribute(lang_object_symbols_statement_enum);
602 }
603 | ';'
604 | CONSTRUCTORS
605 {
606
607 lang_add_attribute(lang_constructors_statement_enum);
608 }
609 | input_section_spec
610 | length '(' exp ')'
611 {
612 lang_add_data($1,$3);
613 }
614
615 | FILL '(' exp ')'
616 {
617 lang_add_fill
618 (exp_get_value_int($3,
619 0,
620 "fill value",
621 lang_first_phase_enum));
622 }
623 ;
624
625 statement_list:
626 statement_list statement
627 | statement
628 ;
629
630 statement_list_opt:
631 /* empty */
632 | statement_list
633 ;
634
635 length:
636 LONG
637 { $$ = $1; }
638 | SHORT
639 { $$ = $1; }
640 | BYTE
641 { $$ = $1; }
642 ;
643
644 fill_opt:
645 '=' mustbe_exp
646 {
647 $$ = exp_get_value_int($2,
648 0,
649 "fill value",
650 lang_first_phase_enum);
651 }
652 | { $$ = 0; }
653 ;
654
655
656
657 assign_op:
658 PLUSEQ
659 { $$ = '+'; }
660 | MINUSEQ
661 { $$ = '-'; }
662 | MULTEQ
663 { $$ = '*'; }
664 | DIVEQ
665 { $$ = '/'; }
666 | LSHIFTEQ
667 { $$ = LSHIFT; }
668 | RSHIFTEQ
669 { $$ = RSHIFT; }
670 | ANDEQ
671 { $$ = '&'; }
672 | OREQ
673 { $$ = '|'; }
674
675 ;
676
677 end: ';' | ','
678 ;
679
680
681 assignment:
682 NAME '=' mustbe_exp
683 {
684 lang_add_assignment(exp_assop($2,$1,$3));
685 }
686 | NAME assign_op mustbe_exp
687 {
688
689 lang_add_assignment(exp_assop('=',$1,exp_binop($2,exp_nameop(NAME,$1),$3)));
690 }
691
692 ;
693
694
695 opt_comma:
696 ',' | ;
697
698
699 memory:
700 MEMORY '{' memory_spec memory_spec_list '}'
701 ;
702
703 memory_spec_list:
704 memory_spec_list memory_spec
705 | memory_spec_list ',' memory_spec
706 |
707 ;
708
709
710 memory_spec: NAME
711 { region = lang_memory_region_lookup($1); }
712 attributes_opt ':'
713 origin_spec opt_comma length_spec
714
715 ; origin_spec:
716 ORIGIN '=' mustbe_exp
717 { region->current =
718 region->origin =
719 exp_get_vma($3, 0L,"origin", lang_first_phase_enum);
720 }
721 ; length_spec:
722 LENGTH '=' mustbe_exp
723 { region->length = exp_get_vma($3,
724 ~((bfd_vma)0),
725 "length",
726 lang_first_phase_enum);
727 }
728
729
730 attributes_opt:
731 '(' NAME ')'
732 {
733 lang_set_flags(&region->flags, $2);
734 }
735 |
736
737 ;
738
739 startup:
740 STARTUP '(' filename ')'
741 { lang_startup($3); }
742 ;
743
744 high_level_library:
745 HLL '(' high_level_library_NAME_list ')'
746 | HLL '(' ')'
747 { ldemul_hll((char *)NULL); }
748 ;
749
750 high_level_library_NAME_list:
751 high_level_library_NAME_list opt_comma filename
752 { ldemul_hll($3); }
753 | filename
754 { ldemul_hll($1); }
755
756 ;
757
758 low_level_library:
759 SYSLIB '(' low_level_library_NAME_list ')'
760 ; low_level_library_NAME_list:
761 low_level_library_NAME_list opt_comma filename
762 { ldemul_syslib($3); }
763 |
764 ;
765
766 floating_point_support:
767 FLOAT
768 { lang_float(true); }
769 | NOFLOAT
770 { lang_float(false); }
771 ;
772
773
774 mustbe_exp: { ldlex_expression(); }
775 exp
776 { ldlex_popstate(); $$=$2;}
777 ;
778
779 exp :
780 '-' exp %prec UNARY
781 { $$ = exp_unop('-', $2); }
782 | '(' exp ')'
783 { $$ = $2; }
784 | NEXT '(' exp ')' %prec UNARY
785 { $$ = exp_unop($1,$3); }
786 | '!' exp %prec UNARY
787 { $$ = exp_unop('!', $2); }
788 | '+' exp %prec UNARY
789 { $$ = $2; }
790 | '~' exp %prec UNARY
791 { $$ = exp_unop('~', $2);}
792
793 | exp '*' exp
794 { $$ = exp_binop('*', $1, $3); }
795 | exp '/' exp
796 { $$ = exp_binop('/', $1, $3); }
797 | exp '%' exp
798 { $$ = exp_binop('%', $1, $3); }
799 | exp '+' exp
800 { $$ = exp_binop('+', $1, $3); }
801 | exp '-' exp
802 { $$ = exp_binop('-' , $1, $3); }
803 | exp LSHIFT exp
804 { $$ = exp_binop(LSHIFT , $1, $3); }
805 | exp RSHIFT exp
806 { $$ = exp_binop(RSHIFT , $1, $3); }
807 | exp EQ exp
808 { $$ = exp_binop(EQ , $1, $3); }
809 | exp NE exp
810 { $$ = exp_binop(NE , $1, $3); }
811 | exp LE exp
812 { $$ = exp_binop(LE , $1, $3); }
813 | exp GE exp
814 { $$ = exp_binop(GE , $1, $3); }
815 | exp '<' exp
816 { $$ = exp_binop('<' , $1, $3); }
817 | exp '>' exp
818 { $$ = exp_binop('>' , $1, $3); }
819 | exp '&' exp
820 { $$ = exp_binop('&' , $1, $3); }
821 | exp '^' exp
822 { $$ = exp_binop('^' , $1, $3); }
823 | exp '|' exp
824 { $$ = exp_binop('|' , $1, $3); }
825 | exp '?' exp ':' exp
826 { $$ = exp_trinop('?' , $1, $3, $5); }
827 | exp ANDAND exp
828 { $$ = exp_binop(ANDAND , $1, $3); }
829 | exp OROR exp
830 { $$ = exp_binop(OROR , $1, $3); }
831 | DEFINED '(' NAME ')'
832 { $$ = exp_nameop(DEFINED, $3); }
833 | INT
834 { $$ = exp_intop($1); }
835 | SIZEOF_HEADERS
836 { $$ = exp_nameop(SIZEOF_HEADERS,0); }
837
838 | SIZEOF '(' NAME ')'
839 { $$ = exp_nameop(SIZEOF,$3); }
840 | ADDR '(' NAME ')'
841 { $$ = exp_nameop(ADDR,$3); }
842 | ABSOLUTE '(' exp ')'
843 { $$ = exp_unop(ABSOLUTE, $3); }
844 | ALIGN_K '(' exp ')'
845 { $$ = exp_unop(ALIGN_K,$3); }
846 | NAME
847 { $$ = exp_nameop(NAME,$1); }
848 ;
849
850
851 opt_at:
852 AT '(' exp ')' { $$ = $3; }
853 | { $$ = 0; }
854 ;
855
856 section: NAME { ldlex_expression(); }
857 opt_exp_with_type
858 opt_at { ldlex_popstate(); }
859 '{'
860 {
861 lang_enter_output_section_statement($1,$3,typebits,0,0,0,$4);
862 }
863 statement_list_opt
864 '}' {ldlex_expression();} fill_opt memspec_opt
865 {
866 ldlex_popstate();
867 lang_leave_output_section_statement($11, $12);
868 }
869 opt_comma
870
871 ;
872
873 type:
874 NOLOAD { typebits = SEC_NEVER_LOAD; }
875 | DSECT { typebits = 0; }
876 | COPY { typebits = 0; }
877 | INFO { typebits = 0; }
878 | OVERLAY { typebits = 0; }
879 | { typebits = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; }
880 ;
881
882
883 opt_exp_with_type:
884 exp ':' { $$ = $1; typebits =0;}
885 | exp '(' type ')' ':' { $$ = $1; }
886 | ':' { $$= (etree_type *)NULL; typebits = 0; }
887 | '(' type ')' ':' { $$= (etree_type *)NULL; }
888 ;
889
890 memspec_opt:
891 '>' NAME
892 { $$ = $2; }
893 | { $$ = "*default*"; }
894 ;
895 %%
896 void
897 yyerror(arg)
898 char *arg;
899 {
900 if (error_index> 0 && error_index < ERROR_NAME_MAX)
901 einfo("%P%F: %S syntax error in %s\n",error_names[error_index-1]);
902 else
903 einfo("%P%F: %S syntax error\n");
904 }
This page took 0.050121 seconds and 4 git commands to generate.