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
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
136 %token NOLOAD DSECT COPY INFO OVERLAY
137 %token DEFINED TARGET_K SEARCH_DIR MAP ENTRY
138 %token <integer> NEXT
139 %token SIZEOF ALIGNOF ADDR LOADADDR MAX_K MIN_K
140 %token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS
142 %token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS
143 %token ALIGNMOD AT SUBALIGN PROVIDE PROVIDE_HIDDEN AS_NEEDED
144 %type <token> assign_op atype attributes_opt sect_constraint
145 %type <name> filename
146 %token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD ASSERT_K
147 %token FORMAT PUBLIC DEFSYMEND BASE ALIAS TRUNCATE REL
148 %token INPUT_SCRIPT INPUT_MRI_SCRIPT INPUT_DEFSYM CASE EXTERN START
149 %token <name> VERS_TAG VERS_IDENTIFIER
150 %token GLOBAL LOCAL VERSIONK INPUT_VERSION_SCRIPT
151 %token KEEP ONLY_IF_RO ONLY_IF_RW SPECIAL
154 %type <versyms> vers_defns
155 %type <versnode> vers_tag
156 %type <deflist> verdep
157 %token INPUT_DYNAMIC_LIST
162 INPUT_SCRIPT script_file
163 | INPUT_MRI_SCRIPT mri_script_file
164 | INPUT_VERSION_SCRIPT version_script_file
165 | INPUT_DYNAMIC_LIST dynamic_list_file
166 | INPUT_DEFSYM defsym_expr
178 lang_add_assignment(exp_assop($3,$2,$4));
182 /* SYNTAX WITHIN AN MRI SCRIPT FILE */
186 PUSH_ERROR (_("MRI style script"));
197 mri_script_lines mri_script_command NEWLINE
205 einfo(_("%P%F: unrecognised keyword in MRI style script '%s'\n"),$1);
208 config.map_filename = "-";
210 | ORDER ordernamelist
212 | PUBLIC NAME '=' exp
213 { mri_public($2, $4); }
214 | PUBLIC NAME ',' exp
215 { mri_public($2, $4); }
217 { mri_public($2, $3); }
221 { mri_output_section($2, $4);}
223 { mri_output_section($2, $3);}
225 { mri_output_section($2, $4);}
226 | ALIGN_K NAME '=' exp
227 { mri_align($2,$4); }
228 | ALIGN_K NAME ',' exp
229 { mri_align($2,$4); }
230 | ALIGNMOD NAME '=' exp
231 { mri_alignmod($2,$4); }
232 | ALIGNMOD NAME ',' exp
233 { mri_alignmod($2,$4); }
234 | ABSOLUTE mri_abs_name_list
235 | LOAD mri_load_name_list
238 | ALIAS NAME ',' NAME
239 { mri_alias($2,$4,0);}
241 { mri_alias ($2, 0, (int) $4.integer); }
245 { mri_truncate ((unsigned int) $2.integer); }
247 | EXTERN extern_name_list
249 { ldlex_script (); ldfile_open_command_file($2); }
251 { ldlex_popstate (); }
253 { lang_add_entry ($2, FALSE); }
258 ordernamelist ',' NAME { mri_order($3); }
259 | ordernamelist NAME { mri_order($2); }
266 | mri_load_name_list ',' NAME { mri_load($3); }
271 { mri_only_load($1); }
272 | mri_abs_name_list ',' NAME
273 { mri_only_load($3); }
277 /* empty */ { $$ = NULL; }
279 | casesymlist ',' NAME
282 /* Parsed as expressions so that commas separate entries */
284 { ldlex_expression (); }
285 extern_name_list_body
286 { ldlex_popstate (); }
288 extern_name_list_body:
290 { ldlang_add_undef ($1); }
291 | extern_name_list_body NAME
292 { ldlang_add_undef ($2); }
293 | extern_name_list_body ',' NAME
294 { ldlang_add_undef ($3); }
300 { ldlex_popstate(); }
316 | floating_point_support
320 | TARGET_K '(' NAME ')'
321 { lang_add_target($3); }
322 | SEARCH_DIR '(' filename ')'
323 { ldfile_add_library_path ($3, FALSE); }
324 | OUTPUT '(' filename ')'
325 { lang_add_output($3, 1); }
326 | OUTPUT_FORMAT '(' NAME ')'
327 { lang_add_output_format ($3, (char *) NULL,
329 | OUTPUT_FORMAT '(' NAME ',' NAME ',' NAME ')'
330 { lang_add_output_format ($3, $5, $7, 1); }
331 | OUTPUT_ARCH '(' NAME ')'
332 { ldfile_set_output_arch ($3, bfd_arch_unknown); }
333 | FORCE_COMMON_ALLOCATION
334 { command_line.force_common_definition = TRUE ; }
335 | INHIBIT_COMMON_ALLOCATION
336 { command_line.inhibit_common_definition = TRUE ; }
337 | INPUT '(' input_list ')'
339 { lang_enter_group (); }
341 { lang_leave_group (); }
342 | MAP '(' filename ')'
343 { lang_add_map($3); }
345 { ldlex_script (); ldfile_open_command_file($2); }
347 { ldlex_popstate (); }
348 | NOCROSSREFS '(' nocrossref_list ')'
350 lang_add_nocrossref ($3);
352 | EXTERN '(' extern_name_list ')'
353 | INSERT_K AFTER NAME
354 { lang_add_insert ($3, 0); }
355 | INSERT_K BEFORE NAME
356 { lang_add_insert ($3, 1); }
357 | REGION_ALIAS '(' NAME ',' NAME ')'
358 { lang_memory_region_alias ($3, $5); }
363 { lang_add_input_file($1,lang_input_file_is_search_file_enum,
365 | input_list ',' NAME
366 { lang_add_input_file($3,lang_input_file_is_search_file_enum,
369 { lang_add_input_file($2,lang_input_file_is_search_file_enum,
372 { lang_add_input_file($1,lang_input_file_is_l_enum,
374 | input_list ',' LNAME
375 { lang_add_input_file($3,lang_input_file_is_l_enum,
378 { lang_add_input_file($2,lang_input_file_is_l_enum,
381 { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
383 { add_DT_NEEDED_for_regular = $<integer>3; }
384 | input_list ',' AS_NEEDED '('
385 { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
387 { add_DT_NEEDED_for_regular = $<integer>5; }
388 | input_list AS_NEEDED '('
389 { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
391 { add_DT_NEEDED_for_regular = $<integer>4; }
395 SECTIONS '{' sec_or_group_p1 '}'
399 sec_or_group_p1 section
400 | sec_or_group_p1 statement_anywhere
406 { lang_add_entry ($3, FALSE); }
408 | ASSERT_K {ldlex_expression ();} '(' exp ',' NAME ')'
410 lang_add_assignment (exp_assert ($4, $6)); }
413 /* The '*' and '?' cases are there because the lexer returns them as
414 separate tokens rather than as NAME. */
435 $$.exclude_name_list = NULL;
437 | EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name
441 $$.exclude_name_list = $3;
443 | SORT_BY_NAME '(' wildcard_name ')'
447 $$.exclude_name_list = NULL;
449 | SORT_BY_ALIGNMENT '(' wildcard_name ')'
452 $$.sorted = by_alignment;
453 $$.exclude_name_list = NULL;
455 | SORT_BY_NAME '(' SORT_BY_ALIGNMENT '(' wildcard_name ')' ')'
458 $$.sorted = by_name_alignment;
459 $$.exclude_name_list = NULL;
461 | SORT_BY_NAME '(' SORT_BY_NAME '(' wildcard_name ')' ')'
465 $$.exclude_name_list = NULL;
467 | SORT_BY_ALIGNMENT '(' SORT_BY_NAME '(' wildcard_name ')' ')'
470 $$.sorted = by_alignment_name;
471 $$.exclude_name_list = NULL;
473 | SORT_BY_ALIGNMENT '(' SORT_BY_ALIGNMENT '(' wildcard_name ')' ')'
476 $$.sorted = by_alignment;
477 $$.exclude_name_list = NULL;
479 | SORT_BY_NAME '(' EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name ')'
483 $$.exclude_name_list = $5;
488 exclude_name_list wildcard_name
490 struct name_list *tmp;
491 tmp = (struct name_list *) xmalloc (sizeof *tmp);
499 struct name_list *tmp;
500 tmp = (struct name_list *) xmalloc (sizeof *tmp);
508 file_NAME_list opt_comma wildcard_spec
510 struct wildcard_list *tmp;
511 tmp = (struct wildcard_list *) xmalloc (sizeof *tmp);
519 struct wildcard_list *tmp;
520 tmp = (struct wildcard_list *) xmalloc (sizeof *tmp);
527 input_section_spec_no_keep:
530 struct wildcard_spec tmp;
532 tmp.exclude_name_list = NULL;
534 lang_add_wild (&tmp, NULL, ldgram_had_keep);
536 | '[' file_NAME_list ']'
538 lang_add_wild (NULL, $2, ldgram_had_keep);
540 | wildcard_spec '(' file_NAME_list ')'
542 lang_add_wild (&$1, $3, ldgram_had_keep);
547 input_section_spec_no_keep
549 { ldgram_had_keep = TRUE; }
550 input_section_spec_no_keep ')'
551 { ldgram_had_keep = FALSE; }
556 | CREATE_OBJECT_SYMBOLS
558 lang_add_attribute(lang_object_symbols_statement_enum);
564 lang_add_attribute(lang_constructors_statement_enum);
566 | SORT_BY_NAME '(' CONSTRUCTORS ')'
568 constructors_sorted = TRUE;
569 lang_add_attribute (lang_constructors_statement_enum);
572 | length '(' mustbe_exp ')'
574 lang_add_data ((int) $1, $3);
577 | FILL '(' fill_exp ')'
581 | ASSERT_K {ldlex_expression ();} '(' exp ',' NAME ')' end
583 lang_add_assignment (exp_assert ($4, $6)); }
585 { ldlex_script (); ldfile_open_command_file($2); }
586 statement_list_opt END
587 { ldlex_popstate (); }
591 statement_list statement
616 $$ = exp_get_fill ($1, 0, "fill value");
623 | { $$ = (fill_type *) 0; }
653 lang_add_assignment (exp_assop ($2, $1, $3));
655 | NAME assign_op mustbe_exp
657 lang_add_assignment (exp_assop ('=', $1,
663 | PROVIDE '(' NAME '=' mustbe_exp ')'
665 lang_add_assignment (exp_provide ($3, $5, FALSE));
667 | PROVIDE_HIDDEN '(' NAME '=' mustbe_exp ')'
669 lang_add_assignment (exp_provide ($3, $5, TRUE));
679 MEMORY '{' memory_spec_list_opt '}'
682 memory_spec_list_opt: memory_spec_list | ;
685 memory_spec_list opt_comma memory_spec
691 { region = lang_memory_region_lookup ($1, TRUE); }
693 origin_spec opt_comma length_spec
696 { ldlex_script (); ldfile_open_command_file($2); }
697 memory_spec_list_opt END
698 { ldlex_popstate (); }
702 ORIGIN '=' mustbe_exp
704 region->origin = exp_get_vma ($3, 0, "origin");
705 region->current = region->origin;
710 LENGTH '=' mustbe_exp
712 region->length = exp_get_vma ($3, -1, "length");
718 { /* dummy action to avoid bison 1.25 error message */ }
719 | '(' attributes_list ')'
724 | attributes_list attributes_string
729 { lang_set_flags (region, $1, 0); }
731 { lang_set_flags (region, $2, 1); }
735 STARTUP '(' filename ')'
736 { lang_startup($3); }
740 HLL '(' high_level_library_NAME_list ')'
742 { ldemul_hll((char *)NULL); }
745 high_level_library_NAME_list:
746 high_level_library_NAME_list opt_comma filename
754 SYSLIB '(' low_level_library_NAME_list ')'
755 ; low_level_library_NAME_list:
756 low_level_library_NAME_list opt_comma filename
757 { ldemul_syslib($3); }
761 floating_point_support:
763 { lang_float(TRUE); }
765 { lang_float(FALSE); }
773 | NAME nocrossref_list
775 struct lang_nocrossref *n;
777 n = (struct lang_nocrossref *) xmalloc (sizeof *n);
782 | NAME ',' nocrossref_list
784 struct lang_nocrossref *n;
786 n = (struct lang_nocrossref *) xmalloc (sizeof *n);
793 mustbe_exp: { ldlex_expression (); }
795 { ldlex_popstate (); $$=$2;}
800 { $$ = exp_unop ('-', $2); }
803 | NEXT '(' exp ')' %prec UNARY
804 { $$ = exp_unop ((int) $1,$3); }
805 | '!' exp %prec UNARY
806 { $$ = exp_unop ('!', $2); }
807 | '+' exp %prec UNARY
809 | '~' exp %prec UNARY
810 { $$ = exp_unop ('~', $2);}
813 { $$ = exp_binop ('*', $1, $3); }
815 { $$ = exp_binop ('/', $1, $3); }
817 { $$ = exp_binop ('%', $1, $3); }
819 { $$ = exp_binop ('+', $1, $3); }
821 { $$ = exp_binop ('-' , $1, $3); }
823 { $$ = exp_binop (LSHIFT , $1, $3); }
825 { $$ = exp_binop (RSHIFT , $1, $3); }
827 { $$ = exp_binop (EQ , $1, $3); }
829 { $$ = exp_binop (NE , $1, $3); }
831 { $$ = exp_binop (LE , $1, $3); }
833 { $$ = exp_binop (GE , $1, $3); }
835 { $$ = exp_binop ('<' , $1, $3); }
837 { $$ = exp_binop ('>' , $1, $3); }
839 { $$ = exp_binop ('&' , $1, $3); }
841 { $$ = exp_binop ('^' , $1, $3); }
843 { $$ = exp_binop ('|' , $1, $3); }
844 | exp '?' exp ':' exp
845 { $$ = exp_trinop ('?' , $1, $3, $5); }
847 { $$ = exp_binop (ANDAND , $1, $3); }
849 { $$ = exp_binop (OROR , $1, $3); }
850 | DEFINED '(' NAME ')'
851 { $$ = exp_nameop (DEFINED, $3); }
853 { $$ = exp_bigintop ($1.integer, $1.str); }
855 { $$ = exp_nameop (SIZEOF_HEADERS,0); }
857 | ALIGNOF '(' NAME ')'
858 { $$ = exp_nameop (ALIGNOF,$3); }
859 | SIZEOF '(' NAME ')'
860 { $$ = exp_nameop (SIZEOF,$3); }
862 { $$ = exp_nameop (ADDR,$3); }
863 | LOADADDR '(' NAME ')'
864 { $$ = exp_nameop (LOADADDR,$3); }
865 | CONSTANT '(' NAME ')'
866 { $$ = exp_nameop (CONSTANT,$3); }
867 | ABSOLUTE '(' exp ')'
868 { $$ = exp_unop (ABSOLUTE, $3); }
869 | ALIGN_K '(' exp ')'
870 { $$ = exp_unop (ALIGN_K,$3); }
871 | ALIGN_K '(' exp ',' exp ')'
872 { $$ = exp_binop (ALIGN_K,$3,$5); }
873 | DATA_SEGMENT_ALIGN '(' exp ',' exp ')'
874 { $$ = exp_binop (DATA_SEGMENT_ALIGN, $3, $5); }
875 | DATA_SEGMENT_RELRO_END '(' exp ',' exp ')'
876 { $$ = exp_binop (DATA_SEGMENT_RELRO_END, $5, $3); }
877 | DATA_SEGMENT_END '(' exp ')'
878 { $$ = exp_unop (DATA_SEGMENT_END, $3); }
879 | SEGMENT_START '(' NAME ',' exp ')'
880 { /* The operands to the expression node are
881 placed in the opposite order from the way
882 in which they appear in the script as
883 that allows us to reuse more code in
885 $$ = exp_binop (SEGMENT_START,
887 exp_nameop (NAME, $3)); }
889 { $$ = exp_unop (ALIGN_K,$3); }
891 { $$ = exp_nameop (NAME,$1); }
892 | MAX_K '(' exp ',' exp ')'
893 { $$ = exp_binop (MAX_K, $3, $5 ); }
894 | MIN_K '(' exp ',' exp ')'
895 { $$ = exp_binop (MIN_K, $3, $5 ); }
896 | ASSERT_K '(' exp ',' NAME ')'
897 { $$ = exp_assert ($3, $5); }
898 | ORIGIN '(' NAME ')'
899 { $$ = exp_nameop (ORIGIN, $3); }
900 | LENGTH '(' NAME ')'
901 { $$ = exp_nameop (LENGTH, $3); }
906 AT '>' NAME { $$ = $3; }
911 AT '(' exp ')' { $$ = $3; }
916 ALIGN_K '(' exp ')' { $$ = $3; }
921 SUBALIGN '(' exp ')' { $$ = $3; }
926 ONLY_IF_RO { $$ = ONLY_IF_RO; }
927 | ONLY_IF_RW { $$ = ONLY_IF_RW; }
928 | SPECIAL { $$ = SPECIAL; }
932 section: NAME { ldlex_expression(); }
936 opt_subalign { ldlex_popstate (); ldlex_script (); }
940 lang_enter_output_section_statement($1, $3,
945 '}' { ldlex_popstate (); ldlex_expression (); }
946 memspec_opt memspec_at_opt phdr_opt fill_opt
949 lang_leave_output_section_statement ($17, $14, $16, $15);
954 { ldlex_expression (); }
955 opt_exp_without_type opt_nocrossrefs opt_at opt_subalign
956 { ldlex_popstate (); ldlex_script (); }
959 lang_enter_overlay ($3, $6);
963 { ldlex_popstate (); ldlex_expression (); }
964 memspec_opt memspec_at_opt phdr_opt fill_opt
967 lang_leave_overlay ($5, (int) $4,
971 | /* The GROUP case is just enough to support the gcc
972 svr3.ifile script. It is not intended to be full
973 support. I'm not even sure what GROUP is supposed
975 GROUP { ldlex_expression (); }
979 lang_add_assignment (exp_assop ('=', ".", $3));
981 '{' sec_or_group_p1 '}'
983 { ldlex_script (); ldfile_open_command_file($2); }
985 { ldlex_popstate (); }
989 NOLOAD { sectype = noload_section; }
990 | DSECT { sectype = noalloc_section; }
991 | COPY { sectype = noalloc_section; }
992 | INFO { sectype = noalloc_section; }
993 | OVERLAY { sectype = noalloc_section; }
998 | /* EMPTY */ { sectype = normal_section; }
999 | '(' ')' { sectype = normal_section; }
1003 exp atype ':' { $$ = $1; }
1004 | atype ':' { $$ = (etree_type *)NULL; }
1005 | /* The BIND cases are to support the gcc svr3.ifile
1006 script. They aren't intended to implement full
1007 support for the BIND keyword. I'm not even sure
1008 what BIND is supposed to mean. */
1009 BIND '(' exp ')' atype ':' { $$ = $3; }
1010 | BIND '(' exp ')' BLOCK '(' exp ')' atype ':'
1014 opt_exp_without_type:
1015 exp ':' { $$ = $1; }
1016 | ':' { $$ = (etree_type *) NULL; }
1029 | { $$ = DEFAULT_MEMORY_REGION; }
1039 struct lang_output_section_phdr_list *n;
1041 n = ((struct lang_output_section_phdr_list *)
1042 xmalloc (sizeof *n));
1056 lang_enter_overlay_section ($2);
1058 '{' statement_list_opt '}'
1059 { ldlex_popstate (); ldlex_expression (); }
1063 lang_leave_overlay_section ($9, $8);
1069 PHDRS '{' phdr_list '}'
1078 NAME { ldlex_expression (); }
1079 phdr_type phdr_qualifiers { ldlex_popstate (); }
1082 lang_new_phdr ($1, $3, $4.filehdr, $4.phdrs, $4.at,
1092 if ($1->type.node_class == etree_name
1093 && $1->type.node_code == NAME)
1097 static const char * const phdr_types[] =
1099 "PT_NULL", "PT_LOAD", "PT_DYNAMIC",
1100 "PT_INTERP", "PT_NOTE", "PT_SHLIB",
1106 i < sizeof phdr_types / sizeof phdr_types[0];
1108 if (strcmp (s, phdr_types[i]) == 0)
1113 if (i == sizeof phdr_types / sizeof phdr_types[0])
1115 if (strcmp (s, "PT_GNU_EH_FRAME") == 0)
1116 $$ = exp_intop (0x6474e550);
1117 else if (strcmp (s, "PT_GNU_STACK") == 0)
1118 $$ = exp_intop (0x6474e551);
1122 %X%P:%S: unknown phdr type `%s' (try integer literal)\n"),
1134 memset (&$$, 0, sizeof (struct phdr_info));
1136 | NAME phdr_val phdr_qualifiers
1139 if (strcmp ($1, "FILEHDR") == 0 && $2 == NULL)
1141 else if (strcmp ($1, "PHDRS") == 0 && $2 == NULL)
1143 else if (strcmp ($1, "FLAGS") == 0 && $2 != NULL)
1146 einfo (_("%X%P:%S: PHDRS syntax error at `%s'\n"), $1);
1148 | AT '(' exp ')' phdr_qualifiers
1168 ldlex_version_file ();
1169 PUSH_ERROR (_("dynamic list"));
1180 | dynamic_list_nodes dynamic_list_node
1184 '{' dynamic_list_tag '}' ';'
1190 lang_append_dynamic_list ($1);
1194 /* This syntax is used within an external version script file. */
1196 version_script_file:
1198 ldlex_version_file ();
1199 PUSH_ERROR (_("VERSION script"));
1208 /* This is used within a normal linker script file. */
1212 ldlex_version_script ();
1214 VERSIONK '{' vers_nodes '}'
1222 | vers_nodes vers_node
1226 '{' vers_tag '}' ';'
1228 lang_register_vers_node (NULL, $2, NULL);
1230 | VERS_TAG '{' vers_tag '}' ';'
1232 lang_register_vers_node ($1, $3, NULL);
1234 | VERS_TAG '{' vers_tag '}' verdep ';'
1236 lang_register_vers_node ($1, $3, $5);
1243 $$ = lang_add_vers_depend (NULL, $1);
1247 $$ = lang_add_vers_depend ($1, $2);
1254 $$ = lang_new_vers_node (NULL, NULL);
1258 $$ = lang_new_vers_node ($1, NULL);
1260 | GLOBAL ':' vers_defns ';'
1262 $$ = lang_new_vers_node ($3, NULL);
1264 | LOCAL ':' vers_defns ';'
1266 $$ = lang_new_vers_node (NULL, $3);
1268 | GLOBAL ':' vers_defns ';' LOCAL ':' vers_defns ';'
1270 $$ = lang_new_vers_node ($3, $7);
1277 $$ = lang_new_vers_pattern (NULL, $1, ldgram_vers_current_lang, FALSE);
1281 $$ = lang_new_vers_pattern (NULL, $1, ldgram_vers_current_lang, TRUE);
1283 | vers_defns ';' VERS_IDENTIFIER
1285 $$ = lang_new_vers_pattern ($1, $3, ldgram_vers_current_lang, FALSE);
1287 | vers_defns ';' NAME
1289 $$ = lang_new_vers_pattern ($1, $3, ldgram_vers_current_lang, TRUE);
1291 | vers_defns ';' EXTERN NAME '{'
1293 $<name>$ = ldgram_vers_current_lang;
1294 ldgram_vers_current_lang = $4;
1296 vers_defns opt_semicolon '}'
1298 struct bfd_elf_version_expr *pat;
1299 for (pat = $7; pat->next != NULL; pat = pat->next);
1302 ldgram_vers_current_lang = $<name>6;
1306 $<name>$ = ldgram_vers_current_lang;
1307 ldgram_vers_current_lang = $2;
1309 vers_defns opt_semicolon '}'
1312 ldgram_vers_current_lang = $<name>4;
1316 $$ = lang_new_vers_pattern (NULL, "global", ldgram_vers_current_lang, FALSE);
1318 | vers_defns ';' GLOBAL
1320 $$ = lang_new_vers_pattern ($1, "global", ldgram_vers_current_lang, FALSE);
1324 $$ = lang_new_vers_pattern (NULL, "local", ldgram_vers_current_lang, FALSE);
1326 | vers_defns ';' LOCAL
1328 $$ = lang_new_vers_pattern ($1, "local", ldgram_vers_current_lang, FALSE);
1332 $$ = lang_new_vers_pattern (NULL, "extern", ldgram_vers_current_lang, FALSE);
1334 | vers_defns ';' EXTERN
1336 $$ = lang_new_vers_pattern ($1, "extern", ldgram_vers_current_lang, FALSE);
1350 if (ldfile_assumed_script)
1351 einfo (_("%P:%s: file format not recognized; treating as linker script\n"),
1352 ldfile_input_filename);
1353 if (error_index > 0 && error_index < ERROR_NAME_MAX)
1354 einfo ("%P%F:%S: %s in %s\n", arg, error_names[error_index-1]);
1356 einfo ("%P%F:%S: %s\n", arg);