1 /* A YACC grammar to parse a superset of the AT&T linker scripting language.
2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
4 Free Software Foundation, Inc.
5 Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
7 This file is part of the GNU Binutils.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22 MA 02110-1301, USA. */
29 #define DONTDECLARE_MALLOC
50 static enum section_type sectype;
51 static lang_memory_region_type *region;
53 bfd_boolean ldgram_had_keep = FALSE;
54 char *ldgram_vers_current_lang = NULL;
56 #define ERROR_NAME_MAX 20
57 static char *error_names[ERROR_NAME_MAX];
58 static int error_index;
59 #define PUSH_ERROR(x) if (error_index < ERROR_NAME_MAX) error_names[error_index] = x; error_index++;
60 #define POP_ERROR() error_index--;
72 struct wildcard_spec wildcard;
73 struct wildcard_list *wildcard_list;
74 struct name_list *name_list;
76 union etree_union *etree;
81 union etree_union *at;
82 union etree_union *flags;
84 struct lang_nocrossref *nocrossref;
85 struct lang_output_section_phdr_list *section_phdr;
86 struct bfd_elf_version_deps *deflist;
87 struct bfd_elf_version_expr *versyms;
88 struct bfd_elf_version_tree *versnode;
91 %type <etree> exp opt_exp_with_type mustbe_exp opt_at phdr_type phdr_val
92 %type <etree> opt_exp_without_type opt_subalign opt_align
93 %type <fill> fill_opt fill_exp
94 %type <name_list> exclude_name_list
95 %type <wildcard_list> file_NAME_list
96 %type <name> memspec_opt casesymlist
97 %type <name> memspec_at_opt
98 %type <cname> wildcard_name
99 %type <wildcard> wildcard_spec
101 %token <name> NAME LNAME
102 %type <integer> length
103 %type <phdr> phdr_qualifiers
104 %type <nocrossref> nocrossref_list
105 %type <section_phdr> phdr_opt
106 %type <integer> opt_nocrossrefs
108 %right <token> PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ
109 %right <token> '?' ':'
116 %left <token> '<' '>' LE GE
117 %left <token> LSHIFT RSHIFT
119 %left <token> '+' '-'
120 %left <token> '*' '/' '%'
125 %token <token> ALIGN_K BLOCK BIND QUAD SQUAD LONG SHORT BYTE
126 %token SECTIONS PHDRS INSERT_K AFTER BEFORE
127 %token DATA_SEGMENT_ALIGN DATA_SEGMENT_RELRO_END DATA_SEGMENT_END
128 %token SORT_BY_NAME SORT_BY_ALIGNMENT
130 %token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH
131 %token INHIBIT_COMMON_ALLOCATION
137 %token NOLOAD DSECT COPY INFO OVERLAY
138 %token DEFINED TARGET_K SEARCH_DIR MAP ENTRY
139 %token <integer> NEXT
140 %token SIZEOF ALIGNOF ADDR LOADADDR MAX_K MIN_K
141 %token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS
143 %token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS
144 %token ALIGNMOD AT SUBALIGN PROVIDE PROVIDE_HIDDEN AS_NEEDED
145 %type <token> assign_op atype attributes_opt sect_constraint
146 %type <name> filename
147 %token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD ASSERT_K
148 %token FORMAT PUBLIC DEFSYMEND BASE ALIAS TRUNCATE REL
149 %token INPUT_SCRIPT INPUT_MRI_SCRIPT INPUT_DEFSYM CASE EXTERN START
150 %token <name> VERS_TAG VERS_IDENTIFIER
151 %token GLOBAL LOCAL VERSIONK INPUT_VERSION_SCRIPT
152 %token KEEP ONLY_IF_RO ONLY_IF_RW SPECIAL
155 %type <versyms> vers_defns
156 %type <versnode> vers_tag
157 %type <deflist> verdep
158 %token INPUT_DYNAMIC_LIST
163 INPUT_SCRIPT script_file
164 | INPUT_MRI_SCRIPT mri_script_file
165 | INPUT_VERSION_SCRIPT version_script_file
166 | INPUT_DYNAMIC_LIST dynamic_list_file
167 | INPUT_DEFSYM defsym_expr
179 lang_add_assignment (exp_defsym ($2, $4));
183 /* SYNTAX WITHIN AN MRI SCRIPT FILE */
187 PUSH_ERROR (_("MRI style script"));
198 mri_script_lines mri_script_command NEWLINE
206 einfo(_("%P%F: unrecognised keyword in MRI style script '%s'\n"),$1);
209 config.map_filename = "-";
211 | ORDER ordernamelist
213 | PUBLIC NAME '=' exp
214 { mri_public($2, $4); }
215 | PUBLIC NAME ',' exp
216 { mri_public($2, $4); }
218 { mri_public($2, $3); }
222 { mri_output_section($2, $4);}
224 { mri_output_section($2, $3);}
226 { mri_output_section($2, $4);}
227 | ALIGN_K NAME '=' exp
228 { mri_align($2,$4); }
229 | ALIGN_K NAME ',' exp
230 { mri_align($2,$4); }
231 | ALIGNMOD NAME '=' exp
232 { mri_alignmod($2,$4); }
233 | ALIGNMOD NAME ',' exp
234 { mri_alignmod($2,$4); }
235 | ABSOLUTE mri_abs_name_list
236 | LOAD mri_load_name_list
239 | ALIAS NAME ',' NAME
240 { mri_alias($2,$4,0);}
242 { mri_alias ($2, 0, (int) $4.integer); }
246 { mri_truncate ((unsigned int) $2.integer); }
248 | EXTERN extern_name_list
250 { ldlex_script (); ldfile_open_command_file($2); }
252 { ldlex_popstate (); }
254 { lang_add_entry ($2, FALSE); }
259 ordernamelist ',' NAME { mri_order($3); }
260 | ordernamelist NAME { mri_order($2); }
267 | mri_load_name_list ',' NAME { mri_load($3); }
272 { mri_only_load($1); }
273 | mri_abs_name_list ',' NAME
274 { mri_only_load($3); }
278 /* empty */ { $$ = NULL; }
280 | casesymlist ',' NAME
283 /* Parsed as expressions so that commas separate entries */
285 { ldlex_expression (); }
286 extern_name_list_body
287 { ldlex_popstate (); }
289 extern_name_list_body:
291 { ldlang_add_undef ($1, FALSE); }
292 | extern_name_list_body NAME
293 { ldlang_add_undef ($2, FALSE); }
294 | extern_name_list_body ',' NAME
295 { ldlang_add_undef ($3, FALSE); }
301 { ldlex_popstate(); }
317 | floating_point_support
321 | TARGET_K '(' NAME ')'
322 { lang_add_target($3); }
323 | SEARCH_DIR '(' filename ')'
324 { ldfile_add_library_path ($3, FALSE); }
325 | OUTPUT '(' filename ')'
326 { lang_add_output($3, 1); }
327 | OUTPUT_FORMAT '(' NAME ')'
328 { lang_add_output_format ($3, (char *) NULL,
330 | OUTPUT_FORMAT '(' NAME ',' NAME ',' NAME ')'
331 { lang_add_output_format ($3, $5, $7, 1); }
332 | OUTPUT_ARCH '(' NAME ')'
333 { ldfile_set_output_arch ($3, bfd_arch_unknown); }
334 | FORCE_COMMON_ALLOCATION
335 { command_line.force_common_definition = TRUE ; }
336 | INHIBIT_COMMON_ALLOCATION
337 { command_line.inhibit_common_definition = TRUE ; }
338 | INPUT '(' input_list ')'
340 { lang_enter_group (); }
342 { lang_leave_group (); }
343 | MAP '(' filename ')'
344 { lang_add_map($3); }
346 { ldlex_script (); ldfile_open_command_file($2); }
348 { ldlex_popstate (); }
349 | NOCROSSREFS '(' nocrossref_list ')'
351 lang_add_nocrossref ($3);
353 | EXTERN '(' extern_name_list ')'
354 | INSERT_K AFTER NAME
355 { lang_add_insert ($3, 0); }
356 | INSERT_K BEFORE NAME
357 { lang_add_insert ($3, 1); }
358 | REGION_ALIAS '(' NAME ',' NAME ')'
359 { lang_memory_region_alias ($3, $5); }
360 | LD_FEATURE '(' NAME ')'
361 { lang_ld_feature ($3); }
366 { lang_add_input_file($1,lang_input_file_is_search_file_enum,
368 | input_list ',' NAME
369 { lang_add_input_file($3,lang_input_file_is_search_file_enum,
372 { lang_add_input_file($2,lang_input_file_is_search_file_enum,
375 { lang_add_input_file($1,lang_input_file_is_l_enum,
377 | input_list ',' LNAME
378 { lang_add_input_file($3,lang_input_file_is_l_enum,
381 { lang_add_input_file($2,lang_input_file_is_l_enum,
384 { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
386 { add_DT_NEEDED_for_regular = $<integer>3; }
387 | input_list ',' AS_NEEDED '('
388 { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
390 { add_DT_NEEDED_for_regular = $<integer>5; }
391 | input_list AS_NEEDED '('
392 { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
394 { add_DT_NEEDED_for_regular = $<integer>4; }
398 SECTIONS '{' sec_or_group_p1 '}'
402 sec_or_group_p1 section
403 | sec_or_group_p1 statement_anywhere
409 { lang_add_entry ($3, FALSE); }
411 | ASSERT_K {ldlex_expression ();} '(' exp ',' NAME ')'
413 lang_add_assignment (exp_assert ($4, $6)); }
416 /* The '*' and '?' cases are there because the lexer returns them as
417 separate tokens rather than as NAME. */
438 $$.exclude_name_list = NULL;
440 | EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name
444 $$.exclude_name_list = $3;
446 | SORT_BY_NAME '(' wildcard_name ')'
450 $$.exclude_name_list = NULL;
452 | SORT_BY_ALIGNMENT '(' wildcard_name ')'
455 $$.sorted = by_alignment;
456 $$.exclude_name_list = NULL;
458 | SORT_BY_NAME '(' SORT_BY_ALIGNMENT '(' wildcard_name ')' ')'
461 $$.sorted = by_name_alignment;
462 $$.exclude_name_list = NULL;
464 | SORT_BY_NAME '(' SORT_BY_NAME '(' wildcard_name ')' ')'
468 $$.exclude_name_list = NULL;
470 | SORT_BY_ALIGNMENT '(' SORT_BY_NAME '(' wildcard_name ')' ')'
473 $$.sorted = by_alignment_name;
474 $$.exclude_name_list = NULL;
476 | SORT_BY_ALIGNMENT '(' SORT_BY_ALIGNMENT '(' wildcard_name ')' ')'
479 $$.sorted = by_alignment;
480 $$.exclude_name_list = NULL;
482 | SORT_BY_NAME '(' EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name ')'
486 $$.exclude_name_list = $5;
491 exclude_name_list wildcard_name
493 struct name_list *tmp;
494 tmp = (struct name_list *) xmalloc (sizeof *tmp);
502 struct name_list *tmp;
503 tmp = (struct name_list *) xmalloc (sizeof *tmp);
511 file_NAME_list opt_comma wildcard_spec
513 struct wildcard_list *tmp;
514 tmp = (struct wildcard_list *) xmalloc (sizeof *tmp);
522 struct wildcard_list *tmp;
523 tmp = (struct wildcard_list *) xmalloc (sizeof *tmp);
530 input_section_spec_no_keep:
533 struct wildcard_spec tmp;
535 tmp.exclude_name_list = NULL;
537 lang_add_wild (&tmp, NULL, ldgram_had_keep);
539 | '[' file_NAME_list ']'
541 lang_add_wild (NULL, $2, ldgram_had_keep);
543 | wildcard_spec '(' file_NAME_list ')'
545 lang_add_wild (&$1, $3, ldgram_had_keep);
550 input_section_spec_no_keep
552 { ldgram_had_keep = TRUE; }
553 input_section_spec_no_keep ')'
554 { ldgram_had_keep = FALSE; }
559 | CREATE_OBJECT_SYMBOLS
561 lang_add_attribute(lang_object_symbols_statement_enum);
567 lang_add_attribute(lang_constructors_statement_enum);
569 | SORT_BY_NAME '(' CONSTRUCTORS ')'
571 constructors_sorted = TRUE;
572 lang_add_attribute (lang_constructors_statement_enum);
575 | length '(' mustbe_exp ')'
577 lang_add_data ((int) $1, $3);
580 | FILL '(' fill_exp ')'
584 | ASSERT_K {ldlex_expression ();} '(' exp ',' NAME ')' end
586 lang_add_assignment (exp_assert ($4, $6)); }
588 { ldlex_script (); ldfile_open_command_file($2); }
589 statement_list_opt END
590 { ldlex_popstate (); }
594 statement_list statement
619 $$ = exp_get_fill ($1, 0, "fill value");
626 | { $$ = (fill_type *) 0; }
656 lang_add_assignment (exp_assign ($1, $3));
658 | NAME assign_op mustbe_exp
660 lang_add_assignment (exp_assign ($1,
666 | PROVIDE '(' NAME '=' mustbe_exp ')'
668 lang_add_assignment (exp_provide ($3, $5, FALSE));
670 | PROVIDE_HIDDEN '(' NAME '=' mustbe_exp ')'
672 lang_add_assignment (exp_provide ($3, $5, TRUE));
682 MEMORY '{' memory_spec_list_opt '}'
685 memory_spec_list_opt: memory_spec_list | ;
688 memory_spec_list opt_comma memory_spec
694 { region = lang_memory_region_lookup ($1, TRUE); }
696 origin_spec opt_comma length_spec
699 { ldlex_script (); ldfile_open_command_file($2); }
700 memory_spec_list_opt END
701 { ldlex_popstate (); }
705 ORIGIN '=' mustbe_exp
707 region->origin = exp_get_vma ($3, 0, "origin");
708 region->current = region->origin;
713 LENGTH '=' mustbe_exp
715 region->length = exp_get_vma ($3, -1, "length");
721 { /* dummy action to avoid bison 1.25 error message */ }
722 | '(' attributes_list ')'
727 | attributes_list attributes_string
732 { lang_set_flags (region, $1, 0); }
734 { lang_set_flags (region, $2, 1); }
738 STARTUP '(' filename ')'
739 { lang_startup($3); }
743 HLL '(' high_level_library_NAME_list ')'
745 { ldemul_hll((char *)NULL); }
748 high_level_library_NAME_list:
749 high_level_library_NAME_list opt_comma filename
757 SYSLIB '(' low_level_library_NAME_list ')'
758 ; low_level_library_NAME_list:
759 low_level_library_NAME_list opt_comma filename
760 { ldemul_syslib($3); }
764 floating_point_support:
766 { lang_float(TRUE); }
768 { lang_float(FALSE); }
776 | NAME nocrossref_list
778 struct lang_nocrossref *n;
780 n = (struct lang_nocrossref *) xmalloc (sizeof *n);
785 | NAME ',' nocrossref_list
787 struct lang_nocrossref *n;
789 n = (struct lang_nocrossref *) xmalloc (sizeof *n);
796 mustbe_exp: { ldlex_expression (); }
798 { ldlex_popstate (); $$=$2;}
803 { $$ = exp_unop ('-', $2); }
806 | NEXT '(' exp ')' %prec UNARY
807 { $$ = exp_unop ((int) $1,$3); }
808 | '!' exp %prec UNARY
809 { $$ = exp_unop ('!', $2); }
810 | '+' exp %prec UNARY
812 | '~' exp %prec UNARY
813 { $$ = exp_unop ('~', $2);}
816 { $$ = exp_binop ('*', $1, $3); }
818 { $$ = exp_binop ('/', $1, $3); }
820 { $$ = exp_binop ('%', $1, $3); }
822 { $$ = exp_binop ('+', $1, $3); }
824 { $$ = exp_binop ('-' , $1, $3); }
826 { $$ = exp_binop (LSHIFT , $1, $3); }
828 { $$ = exp_binop (RSHIFT , $1, $3); }
830 { $$ = exp_binop (EQ , $1, $3); }
832 { $$ = exp_binop (NE , $1, $3); }
834 { $$ = exp_binop (LE , $1, $3); }
836 { $$ = exp_binop (GE , $1, $3); }
838 { $$ = exp_binop ('<' , $1, $3); }
840 { $$ = exp_binop ('>' , $1, $3); }
842 { $$ = exp_binop ('&' , $1, $3); }
844 { $$ = exp_binop ('^' , $1, $3); }
846 { $$ = exp_binop ('|' , $1, $3); }
847 | exp '?' exp ':' exp
848 { $$ = exp_trinop ('?' , $1, $3, $5); }
850 { $$ = exp_binop (ANDAND , $1, $3); }
852 { $$ = exp_binop (OROR , $1, $3); }
853 | DEFINED '(' NAME ')'
854 { $$ = exp_nameop (DEFINED, $3); }
856 { $$ = exp_bigintop ($1.integer, $1.str); }
858 { $$ = exp_nameop (SIZEOF_HEADERS,0); }
860 | ALIGNOF '(' NAME ')'
861 { $$ = exp_nameop (ALIGNOF,$3); }
862 | SIZEOF '(' NAME ')'
863 { $$ = exp_nameop (SIZEOF,$3); }
865 { $$ = exp_nameop (ADDR,$3); }
866 | LOADADDR '(' NAME ')'
867 { $$ = exp_nameop (LOADADDR,$3); }
868 | CONSTANT '(' NAME ')'
869 { $$ = exp_nameop (CONSTANT,$3); }
870 | ABSOLUTE '(' exp ')'
871 { $$ = exp_unop (ABSOLUTE, $3); }
872 | ALIGN_K '(' exp ')'
873 { $$ = exp_unop (ALIGN_K,$3); }
874 | ALIGN_K '(' exp ',' exp ')'
875 { $$ = exp_binop (ALIGN_K,$3,$5); }
876 | DATA_SEGMENT_ALIGN '(' exp ',' exp ')'
877 { $$ = exp_binop (DATA_SEGMENT_ALIGN, $3, $5); }
878 | DATA_SEGMENT_RELRO_END '(' exp ',' exp ')'
879 { $$ = exp_binop (DATA_SEGMENT_RELRO_END, $5, $3); }
880 | DATA_SEGMENT_END '(' exp ')'
881 { $$ = exp_unop (DATA_SEGMENT_END, $3); }
882 | SEGMENT_START '(' NAME ',' exp ')'
883 { /* The operands to the expression node are
884 placed in the opposite order from the way
885 in which they appear in the script as
886 that allows us to reuse more code in
888 $$ = exp_binop (SEGMENT_START,
890 exp_nameop (NAME, $3)); }
892 { $$ = exp_unop (ALIGN_K,$3); }
894 { $$ = exp_nameop (NAME,$1); }
895 | MAX_K '(' exp ',' exp ')'
896 { $$ = exp_binop (MAX_K, $3, $5 ); }
897 | MIN_K '(' exp ',' exp ')'
898 { $$ = exp_binop (MIN_K, $3, $5 ); }
899 | ASSERT_K '(' exp ',' NAME ')'
900 { $$ = exp_assert ($3, $5); }
901 | ORIGIN '(' NAME ')'
902 { $$ = exp_nameop (ORIGIN, $3); }
903 | LENGTH '(' NAME ')'
904 { $$ = exp_nameop (LENGTH, $3); }
909 AT '>' NAME { $$ = $3; }
914 AT '(' exp ')' { $$ = $3; }
919 ALIGN_K '(' exp ')' { $$ = $3; }
924 SUBALIGN '(' exp ')' { $$ = $3; }
929 ONLY_IF_RO { $$ = ONLY_IF_RO; }
930 | ONLY_IF_RW { $$ = ONLY_IF_RW; }
931 | SPECIAL { $$ = SPECIAL; }
935 section: NAME { ldlex_expression(); }
939 opt_subalign { ldlex_popstate (); ldlex_script (); }
943 lang_enter_output_section_statement($1, $3,
948 '}' { ldlex_popstate (); ldlex_expression (); }
949 memspec_opt memspec_at_opt phdr_opt fill_opt
952 lang_leave_output_section_statement ($17, $14, $16, $15);
957 { ldlex_expression (); }
958 opt_exp_without_type opt_nocrossrefs opt_at opt_subalign
959 { ldlex_popstate (); ldlex_script (); }
962 lang_enter_overlay ($3, $6);
966 { ldlex_popstate (); ldlex_expression (); }
967 memspec_opt memspec_at_opt phdr_opt fill_opt
970 lang_leave_overlay ($5, (int) $4,
974 | /* The GROUP case is just enough to support the gcc
975 svr3.ifile script. It is not intended to be full
976 support. I'm not even sure what GROUP is supposed
978 GROUP { ldlex_expression (); }
982 lang_add_assignment (exp_assign (".", $3));
984 '{' sec_or_group_p1 '}'
986 { ldlex_script (); ldfile_open_command_file($2); }
988 { ldlex_popstate (); }
992 NOLOAD { sectype = noload_section; }
993 | DSECT { sectype = noalloc_section; }
994 | COPY { sectype = noalloc_section; }
995 | INFO { sectype = noalloc_section; }
996 | OVERLAY { sectype = noalloc_section; }
1001 | /* EMPTY */ { sectype = normal_section; }
1002 | '(' ')' { sectype = normal_section; }
1006 exp atype ':' { $$ = $1; }
1007 | atype ':' { $$ = (etree_type *)NULL; }
1008 | /* The BIND cases are to support the gcc svr3.ifile
1009 script. They aren't intended to implement full
1010 support for the BIND keyword. I'm not even sure
1011 what BIND is supposed to mean. */
1012 BIND '(' exp ')' atype ':' { $$ = $3; }
1013 | BIND '(' exp ')' BLOCK '(' exp ')' atype ':'
1017 opt_exp_without_type:
1018 exp ':' { $$ = $1; }
1019 | ':' { $$ = (etree_type *) NULL; }
1032 | { $$ = DEFAULT_MEMORY_REGION; }
1042 struct lang_output_section_phdr_list *n;
1044 n = ((struct lang_output_section_phdr_list *)
1045 xmalloc (sizeof *n));
1059 lang_enter_overlay_section ($2);
1061 '{' statement_list_opt '}'
1062 { ldlex_popstate (); ldlex_expression (); }
1066 lang_leave_overlay_section ($9, $8);
1072 PHDRS '{' phdr_list '}'
1081 NAME { ldlex_expression (); }
1082 phdr_type phdr_qualifiers { ldlex_popstate (); }
1085 lang_new_phdr ($1, $3, $4.filehdr, $4.phdrs, $4.at,
1095 if ($1->type.node_class == etree_name
1096 && $1->type.node_code == NAME)
1100 static const char * const phdr_types[] =
1102 "PT_NULL", "PT_LOAD", "PT_DYNAMIC",
1103 "PT_INTERP", "PT_NOTE", "PT_SHLIB",
1109 i < sizeof phdr_types / sizeof phdr_types[0];
1111 if (strcmp (s, phdr_types[i]) == 0)
1116 if (i == sizeof phdr_types / sizeof phdr_types[0])
1118 if (strcmp (s, "PT_GNU_EH_FRAME") == 0)
1119 $$ = exp_intop (0x6474e550);
1120 else if (strcmp (s, "PT_GNU_STACK") == 0)
1121 $$ = exp_intop (0x6474e551);
1125 %X%P:%S: unknown phdr type `%s' (try integer literal)\n"),
1137 memset (&$$, 0, sizeof (struct phdr_info));
1139 | NAME phdr_val phdr_qualifiers
1142 if (strcmp ($1, "FILEHDR") == 0 && $2 == NULL)
1144 else if (strcmp ($1, "PHDRS") == 0 && $2 == NULL)
1146 else if (strcmp ($1, "FLAGS") == 0 && $2 != NULL)
1149 einfo (_("%X%P:%S: PHDRS syntax error at `%s'\n"), $1);
1151 | AT '(' exp ')' phdr_qualifiers
1171 ldlex_version_file ();
1172 PUSH_ERROR (_("dynamic list"));
1183 | dynamic_list_nodes dynamic_list_node
1187 '{' dynamic_list_tag '}' ';'
1193 lang_append_dynamic_list ($1);
1197 /* This syntax is used within an external version script file. */
1199 version_script_file:
1201 ldlex_version_file ();
1202 PUSH_ERROR (_("VERSION script"));
1211 /* This is used within a normal linker script file. */
1215 ldlex_version_script ();
1217 VERSIONK '{' vers_nodes '}'
1225 | vers_nodes vers_node
1229 '{' vers_tag '}' ';'
1231 lang_register_vers_node (NULL, $2, NULL);
1233 | VERS_TAG '{' vers_tag '}' ';'
1235 lang_register_vers_node ($1, $3, NULL);
1237 | VERS_TAG '{' vers_tag '}' verdep ';'
1239 lang_register_vers_node ($1, $3, $5);
1246 $$ = lang_add_vers_depend (NULL, $1);
1250 $$ = lang_add_vers_depend ($1, $2);
1257 $$ = lang_new_vers_node (NULL, NULL);
1261 $$ = lang_new_vers_node ($1, NULL);
1263 | GLOBAL ':' vers_defns ';'
1265 $$ = lang_new_vers_node ($3, NULL);
1267 | LOCAL ':' vers_defns ';'
1269 $$ = lang_new_vers_node (NULL, $3);
1271 | GLOBAL ':' vers_defns ';' LOCAL ':' vers_defns ';'
1273 $$ = lang_new_vers_node ($3, $7);
1280 $$ = lang_new_vers_pattern (NULL, $1, ldgram_vers_current_lang, FALSE);
1284 $$ = lang_new_vers_pattern (NULL, $1, ldgram_vers_current_lang, TRUE);
1286 | vers_defns ';' VERS_IDENTIFIER
1288 $$ = lang_new_vers_pattern ($1, $3, ldgram_vers_current_lang, FALSE);
1290 | vers_defns ';' NAME
1292 $$ = lang_new_vers_pattern ($1, $3, ldgram_vers_current_lang, TRUE);
1294 | vers_defns ';' EXTERN NAME '{'
1296 $<name>$ = ldgram_vers_current_lang;
1297 ldgram_vers_current_lang = $4;
1299 vers_defns opt_semicolon '}'
1301 struct bfd_elf_version_expr *pat;
1302 for (pat = $7; pat->next != NULL; pat = pat->next);
1305 ldgram_vers_current_lang = $<name>6;
1309 $<name>$ = ldgram_vers_current_lang;
1310 ldgram_vers_current_lang = $2;
1312 vers_defns opt_semicolon '}'
1315 ldgram_vers_current_lang = $<name>4;
1319 $$ = lang_new_vers_pattern (NULL, "global", ldgram_vers_current_lang, FALSE);
1321 | vers_defns ';' GLOBAL
1323 $$ = lang_new_vers_pattern ($1, "global", ldgram_vers_current_lang, FALSE);
1327 $$ = lang_new_vers_pattern (NULL, "local", ldgram_vers_current_lang, FALSE);
1329 | vers_defns ';' LOCAL
1331 $$ = lang_new_vers_pattern ($1, "local", ldgram_vers_current_lang, FALSE);
1335 $$ = lang_new_vers_pattern (NULL, "extern", ldgram_vers_current_lang, FALSE);
1337 | vers_defns ';' EXTERN
1339 $$ = lang_new_vers_pattern ($1, "extern", ldgram_vers_current_lang, FALSE);
1353 if (ldfile_assumed_script)
1354 einfo (_("%P:%s: file format not recognized; treating as linker script\n"),
1355 ldfile_input_filename);
1356 if (error_index > 0 && error_index < ERROR_NAME_MAX)
1357 einfo ("%P%F:%S: %s in %s\n", arg, error_names[error_index-1]);
1359 einfo ("%P%F:%S: %s\n", arg);