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 Free Software Foundation, Inc.
4 Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
6 This file is part of GNU ld.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
27 #define DONTDECLARE_MALLOC
48 static enum section_type sectype
;
49 static lang_memory_region_type
*region
;
51 FILE *saved_script_handle
= NULL
;
52 bfd_boolean force_make_executable
= FALSE
;
54 bfd_boolean ldgram_in_script
= FALSE
;
55 bfd_boolean ldgram_had_equals
= FALSE
;
56 bfd_boolean ldgram_had_keep
= FALSE
;
57 char *ldgram_vers_current_lang
= NULL
;
59 #define ERROR_NAME_MAX 20
60 static char *error_names
[ERROR_NAME_MAX
];
61 static int error_index
;
62 #define PUSH_ERROR(x) if (error_index < ERROR_NAME_MAX) error_names[error_index] = x; error_index++;
63 #define POP_ERROR() error_index--;
75 struct wildcard_spec wildcard
;
76 struct wildcard_list
*wildcard_list
;
77 struct name_list
*name_list
;
79 union etree_union
*etree
;
84 union etree_union
*at
;
85 union etree_union
*flags
;
87 struct lang_nocrossref
*nocrossref
;
88 struct lang_output_section_phdr_list
*section_phdr
;
89 struct bfd_elf_version_deps
*deflist
;
90 struct bfd_elf_version_expr
*versyms
;
91 struct bfd_elf_version_tree
*versnode
;
94 %type
<etree
> exp opt_exp_with_type mustbe_exp opt_at phdr_type phdr_val
95 %type
<etree
> opt_exp_without_type opt_subalign
96 %type
<fill
> fill_opt fill_exp
97 %type
<name_list
> exclude_name_list
98 %type
<wildcard_list
> file_NAME_list
99 %type
<name
> memspec_opt casesymlist
100 %type
<name
> memspec_at_opt
101 %type
<cname
> wildcard_name
102 %type
<wildcard
> wildcard_spec
104 %token
<name
> NAME LNAME
105 %type
<integer
> length
106 %type
<phdr
> phdr_qualifiers
107 %type
<nocrossref
> nocrossref_list
108 %type
<section_phdr
> phdr_opt
109 %type
<integer
> opt_nocrossrefs
111 %right
<token
> PLUSEQ MINUSEQ MULTEQ DIVEQ
'=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ
112 %right
<token
> '?' ':'
119 %left
<token
> '<' '>' LE GE
120 %left
<token
> LSHIFT RSHIFT
122 %left
<token
> '+' '-'
123 %left
<token
> '*' '/' '%'
128 %token
<token
> ALIGN_K BLOCK BIND QUAD SQUAD LONG SHORT BYTE
129 %token SECTIONS PHDRS DATA_SEGMENT_ALIGN DATA_SEGMENT_RELRO_END DATA_SEGMENT_END
130 %token SORT_BY_NAME SORT_BY_ALIGNMENT
132 %token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH
133 %token INHIBIT_COMMON_ALLOCATION
134 %token SIZEOF_HEADERS
137 %token MEMORY DEFSYMEND
138 %token NOLOAD DSECT COPY INFO OVERLAY
139 %token NAME LNAME DEFINED TARGET_K SEARCH_DIR MAP ENTRY
140 %token
<integer
> NEXT
141 %token SIZEOF ADDR LOADADDR MAX_K MIN_K
142 %token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS
144 %token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS
145 %token ALIGNMOD AT SUBALIGN PROVIDE AS_NEEDED
146 %type
<token
> assign_op atype attributes_opt sect_constraint
147 %type
<name
> filename
148 %token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD ASSERT_K
149 %token FORMAT PUBLIC DEFSYMEND BASE ALIAS TRUNCATE REL
150 %token INPUT_SCRIPT INPUT_MRI_SCRIPT INPUT_DEFSYM CASE EXTERN START
151 %token
<name
> VERS_TAG VERS_IDENTIFIER
152 %token GLOBAL LOCAL VERSIONK INPUT_VERSION_SCRIPT
153 %token KEEP ONLY_IF_RO ONLY_IF_RW SPECIAL
155 %type
<versyms
> vers_defns
156 %type
<versnode
> vers_tag
157 %type
<deflist
> verdep
162 INPUT_SCRIPT script_file
163 | INPUT_MRI_SCRIPT mri_script_file
164 | INPUT_VERSION_SCRIPT version_script_file
165 | INPUT_DEFSYM defsym_expr
177 lang_add_assignment
(exp_assop
($3,$2,$4));
181 /* SYNTAX WITHIN AN MRI SCRIPT FILE */
185 PUSH_ERROR
(_
("MRI style script"));
196 mri_script_lines mri_script_command NEWLINE
204 einfo
(_
("%P%F: unrecognised keyword in MRI style script '%s'\n"),$1);
207 config.map_filename
= "-";
209 | ORDER ordernamelist
211 | PUBLIC NAME
'=' exp
212 { mri_public
($2, $4); }
213 | PUBLIC NAME
',' exp
214 { mri_public
($2, $4); }
216 { mri_public
($2, $3); }
220 { mri_output_section
($2, $4);}
222 { mri_output_section
($2, $3);}
224 { mri_output_section
($2, $4);}
225 | ALIGN_K NAME
'=' exp
226 { mri_align
($2,$4); }
227 | ALIGN_K NAME
',' exp
228 { mri_align
($2,$4); }
229 | ALIGNMOD NAME
'=' exp
230 { mri_alignmod
($2,$4); }
231 | ALIGNMOD NAME
',' exp
232 { mri_alignmod
($2,$4); }
233 | ABSOLUTE mri_abs_name_list
234 | LOAD mri_load_name_list
237 | ALIAS NAME
',' NAME
238 { mri_alias
($2,$4,0);}
240 { mri_alias
($2, 0, (int) $4.integer
); }
244 { mri_truncate
((unsigned int) $2.integer
); }
246 | EXTERN extern_name_list
248 { ldlex_script
(); ldfile_open_command_file
($2); }
250 { ldlex_popstate
(); }
252 { lang_add_entry
($2, FALSE
); }
257 ordernamelist
',' NAME
{ mri_order
($3); }
258 | ordernamelist NAME
{ mri_order
($2); }
265 | mri_load_name_list
',' NAME
{ mri_load
($3); }
270 { mri_only_load
($1); }
271 | mri_abs_name_list
',' NAME
272 { mri_only_load
($3); }
276 /* empty */ { $$
= NULL
; }
278 | casesymlist
',' NAME
283 { ldlang_add_undef
($1); }
284 | extern_name_list NAME
285 { ldlang_add_undef
($2); }
286 | extern_name_list
',' NAME
287 { ldlang_add_undef
($3); }
315 | floating_point_support
319 | TARGET_K
'(' NAME
')'
320 { lang_add_target
($3); }
321 | SEARCH_DIR
'(' filename
')'
322 { ldfile_add_library_path
($3, FALSE
); }
323 | OUTPUT
'(' filename
')'
324 { lang_add_output
($3, 1); }
325 | OUTPUT_FORMAT
'(' NAME
')'
326 { lang_add_output_format
($3, (char *) NULL
,
328 | OUTPUT_FORMAT
'(' NAME
',' NAME
',' NAME
')'
329 { lang_add_output_format
($3, $5, $7, 1); }
330 | OUTPUT_ARCH
'(' NAME
')'
331 { ldfile_set_output_arch
($3, bfd_arch_unknown
); }
332 | FORCE_COMMON_ALLOCATION
333 { command_line.force_common_definition
= TRUE
; }
334 | INHIBIT_COMMON_ALLOCATION
335 { command_line.inhibit_common_definition
= TRUE
; }
336 | INPUT
'(' input_list
')'
338 { lang_enter_group
(); }
340 { lang_leave_group
(); }
341 | MAP
'(' filename
')'
342 { lang_add_map
($3); }
344 { ldlex_script
(); ldfile_open_command_file
($2); }
346 { ldlex_popstate
(); }
347 | NOCROSSREFS
'(' nocrossref_list
')'
349 lang_add_nocrossref
($3);
351 | EXTERN
'(' extern_name_list
')'
356 { lang_add_input_file
($1,lang_input_file_is_search_file_enum
,
358 | input_list
',' NAME
359 { lang_add_input_file
($3,lang_input_file_is_search_file_enum
,
362 { lang_add_input_file
($2,lang_input_file_is_search_file_enum
,
365 { lang_add_input_file
($1,lang_input_file_is_l_enum
,
367 | input_list
',' LNAME
368 { lang_add_input_file
($3,lang_input_file_is_l_enum
,
371 { lang_add_input_file
($2,lang_input_file_is_l_enum
,
374 { $
<integer
>$
= as_needed
; as_needed
= TRUE
; }
376 { as_needed
= $
<integer
>3; }
377 | input_list
',' AS_NEEDED
'('
378 { $
<integer
>$
= as_needed
; as_needed
= TRUE
; }
380 { as_needed
= $
<integer
>5; }
381 | input_list AS_NEEDED
'('
382 { $
<integer
>$
= as_needed
; as_needed
= TRUE
; }
384 { as_needed
= $
<integer
>4; }
388 SECTIONS
'{' sec_or_group_p1
'}'
392 sec_or_group_p1 section
393 | sec_or_group_p1 statement_anywhere
399 { lang_add_entry
($3, FALSE
); }
401 | ASSERT_K
{ldlex_expression
();} '(' exp
',' NAME
')'
403 lang_add_assignment
(exp_assert
($4, $6)); }
406 /* The '*' and '?' cases are there because the lexer returns them as
407 separate tokens rather than as NAME. */
428 $$.exclude_name_list
= NULL
;
430 | EXCLUDE_FILE
'(' exclude_name_list
')' wildcard_name
434 $$.exclude_name_list
= $3;
436 | SORT_BY_NAME
'(' wildcard_name
')'
440 $$.exclude_name_list
= NULL
;
442 | SORT_BY_ALIGNMENT
'(' wildcard_name
')'
445 $$.sorted
= by_alignment
;
446 $$.exclude_name_list
= NULL
;
448 | SORT_BY_NAME
'(' SORT_BY_ALIGNMENT
'(' wildcard_name
')' ')'
451 $$.sorted
= by_name_alignment
;
452 $$.exclude_name_list
= NULL
;
454 | SORT_BY_NAME
'(' SORT_BY_NAME
'(' wildcard_name
')' ')'
458 $$.exclude_name_list
= NULL
;
460 | SORT_BY_ALIGNMENT
'(' SORT_BY_NAME
'(' wildcard_name
')' ')'
463 $$.sorted
= by_alignment_name
;
464 $$.exclude_name_list
= NULL
;
466 | SORT_BY_ALIGNMENT
'(' SORT_BY_ALIGNMENT
'(' wildcard_name
')' ')'
469 $$.sorted
= by_alignment
;
470 $$.exclude_name_list
= NULL
;
472 | SORT_BY_NAME
'(' EXCLUDE_FILE
'(' exclude_name_list
')' wildcard_name
')'
476 $$.exclude_name_list
= $5;
481 exclude_name_list wildcard_name
483 struct name_list
*tmp
;
484 tmp
= (struct name_list
*) xmalloc
(sizeof
*tmp
);
492 struct name_list
*tmp
;
493 tmp
= (struct name_list
*) xmalloc
(sizeof
*tmp
);
501 file_NAME_list opt_comma wildcard_spec
503 struct wildcard_list
*tmp
;
504 tmp
= (struct wildcard_list
*) xmalloc
(sizeof
*tmp
);
512 struct wildcard_list
*tmp
;
513 tmp
= (struct wildcard_list
*) xmalloc
(sizeof
*tmp
);
520 input_section_spec_no_keep:
523 struct wildcard_spec tmp
;
525 tmp.exclude_name_list
= NULL
;
527 lang_add_wild
(&tmp
, NULL
, ldgram_had_keep
);
529 |
'[' file_NAME_list
']'
531 lang_add_wild
(NULL
, $2, ldgram_had_keep
);
533 | wildcard_spec
'(' file_NAME_list
')'
535 lang_add_wild
(&$1, $3, ldgram_had_keep
);
540 input_section_spec_no_keep
542 { ldgram_had_keep
= TRUE
; }
543 input_section_spec_no_keep
')'
544 { ldgram_had_keep
= FALSE
; }
549 | CREATE_OBJECT_SYMBOLS
551 lang_add_attribute
(lang_object_symbols_statement_enum
);
557 lang_add_attribute
(lang_constructors_statement_enum
);
559 | SORT_BY_NAME
'(' CONSTRUCTORS
')'
561 constructors_sorted
= TRUE
;
562 lang_add_attribute
(lang_constructors_statement_enum
);
565 | length
'(' mustbe_exp
')'
567 lang_add_data
((int) $1, $3);
570 | FILL
'(' fill_exp
')'
577 statement_list statement
602 $$
= exp_get_fill
($1, 0, "fill value");
609 |
{ $$
= (fill_type
*) 0; }
639 lang_add_assignment
(exp_assop
($2, $1, $3));
641 | NAME assign_op mustbe_exp
643 lang_add_assignment
(exp_assop
('=', $1,
649 | PROVIDE
'(' NAME
'=' mustbe_exp
')'
651 lang_add_assignment
(exp_provide
($3, $5));
661 MEMORY
'{' memory_spec memory_spec_list
'}'
665 memory_spec_list memory_spec
666 | memory_spec_list
',' memory_spec
672 { region
= lang_memory_region_lookup
($1, TRUE
); }
674 origin_spec opt_comma length_spec
679 ORIGIN
'=' mustbe_exp
681 region
->origin
= exp_get_vma
($3, 0, "origin");
682 region
->current
= region
->origin
;
687 LENGTH
'=' mustbe_exp
689 region
->length
= exp_get_vma
($3, -1, "length");
695 { /* dummy action to avoid bison 1.25 error message */ }
696 |
'(' attributes_list
')'
701 | attributes_list attributes_string
706 { lang_set_flags
(region
, $1, 0); }
708 { lang_set_flags
(region
, $2, 1); }
712 STARTUP
'(' filename
')'
713 { lang_startup
($3); }
717 HLL
'(' high_level_library_NAME_list
')'
719 { ldemul_hll
((char *)NULL
); }
722 high_level_library_NAME_list:
723 high_level_library_NAME_list opt_comma filename
731 SYSLIB
'(' low_level_library_NAME_list
')'
732 ; low_level_library_NAME_list
:
733 low_level_library_NAME_list opt_comma filename
734 { ldemul_syslib
($3); }
738 floating_point_support:
740 { lang_float
(TRUE
); }
742 { lang_float
(FALSE
); }
750 | NAME nocrossref_list
752 struct lang_nocrossref
*n
;
754 n
= (struct lang_nocrossref
*) xmalloc
(sizeof
*n
);
759 | NAME
',' nocrossref_list
761 struct lang_nocrossref
*n
;
763 n
= (struct lang_nocrossref
*) xmalloc
(sizeof
*n
);
770 mustbe_exp: { ldlex_expression
(); }
772 { ldlex_popstate
(); $$
=$2;}
777 { $$
= exp_unop
('-', $2); }
780 | NEXT
'(' exp
')' %prec UNARY
781 { $$
= exp_unop
((int) $1,$3); }
782 |
'!' exp %prec UNARY
783 { $$
= exp_unop
('!', $2); }
784 |
'+' exp %prec UNARY
786 |
'~' exp %prec UNARY
787 { $$
= exp_unop
('~', $2);}
790 { $$
= exp_binop
('*', $1, $3); }
792 { $$
= exp_binop
('/', $1, $3); }
794 { $$
= exp_binop
('%', $1, $3); }
796 { $$
= exp_binop
('+', $1, $3); }
798 { $$
= exp_binop
('-' , $1, $3); }
800 { $$
= exp_binop
(LSHIFT
, $1, $3); }
802 { $$
= exp_binop
(RSHIFT
, $1, $3); }
804 { $$
= exp_binop
(EQ
, $1, $3); }
806 { $$
= exp_binop
(NE
, $1, $3); }
808 { $$
= exp_binop
(LE
, $1, $3); }
810 { $$
= exp_binop
(GE
, $1, $3); }
812 { $$
= exp_binop
('<' , $1, $3); }
814 { $$
= exp_binop
('>' , $1, $3); }
816 { $$
= exp_binop
('&' , $1, $3); }
818 { $$
= exp_binop
('^' , $1, $3); }
820 { $$
= exp_binop
('|' , $1, $3); }
821 | exp
'?' exp
':' exp
822 { $$
= exp_trinop
('?' , $1, $3, $5); }
824 { $$
= exp_binop
(ANDAND
, $1, $3); }
826 { $$
= exp_binop
(OROR
, $1, $3); }
827 | DEFINED
'(' NAME
')'
828 { $$
= exp_nameop
(DEFINED
, $3); }
830 { $$
= exp_bigintop
($1.integer
, $1.str
); }
832 { $$
= exp_nameop
(SIZEOF_HEADERS
,0); }
834 | SIZEOF
'(' NAME
')'
835 { $$
= exp_nameop
(SIZEOF
,$3); }
837 { $$
= exp_nameop
(ADDR
,$3); }
838 | LOADADDR
'(' NAME
')'
839 { $$
= exp_nameop
(LOADADDR
,$3); }
840 | ABSOLUTE
'(' exp
')'
841 { $$
= exp_unop
(ABSOLUTE
, $3); }
842 | ALIGN_K
'(' exp
')'
843 { $$
= exp_unop
(ALIGN_K
,$3); }
844 | ALIGN_K
'(' exp
',' exp
')'
845 { $$
= exp_binop
(ALIGN_K
,$3,$5); }
846 | DATA_SEGMENT_ALIGN
'(' exp
',' exp
')'
847 { $$
= exp_binop
(DATA_SEGMENT_ALIGN
, $3, $5); }
848 | DATA_SEGMENT_RELRO_END
'(' exp
',' exp
')'
849 { $$
= exp_binop
(DATA_SEGMENT_RELRO_END
, $5, $3); }
850 | DATA_SEGMENT_END
'(' exp
')'
851 { $$
= exp_unop
(DATA_SEGMENT_END
, $3); }
852 | SEGMENT_START
'(' NAME
',' exp
')'
853 { /* The operands to the expression node are
854 placed in the opposite order from the way
855 in which they appear in the script as
856 that allows us to reuse more code in
858 $$
= exp_binop
(SEGMENT_START
,
860 exp_nameop
(NAME
, $3)); }
862 { $$
= exp_unop
(ALIGN_K
,$3); }
864 { $$
= exp_nameop
(NAME
,$1); }
865 | MAX_K
'(' exp
',' exp
')'
866 { $$
= exp_binop
(MAX_K
, $3, $5 ); }
867 | MIN_K
'(' exp
',' exp
')'
868 { $$
= exp_binop
(MIN_K
, $3, $5 ); }
869 | ASSERT_K
'(' exp
',' NAME
')'
870 { $$
= exp_assert
($3, $5); }
871 | ORIGIN
'(' NAME
')'
872 { $$
= exp_nameop
(ORIGIN
, $3); }
873 | LENGTH
'(' NAME
')'
874 { $$
= exp_nameop
(LENGTH
, $3); }
879 AT
'>' NAME
{ $$
= $3; }
884 AT
'(' exp
')' { $$
= $3; }
889 SUBALIGN
'(' exp
')' { $$
= $3; }
894 ONLY_IF_RO
{ $$
= ONLY_IF_RO
; }
895 | ONLY_IF_RW
{ $$
= ONLY_IF_RW
; }
896 | SPECIAL
{ $$
= SPECIAL
; }
900 section: NAME
{ ldlex_expression
(); }
903 opt_subalign
{ ldlex_popstate
(); ldlex_script
(); }
907 lang_enter_output_section_statement
($1, $3,
912 '}' { ldlex_popstate
(); ldlex_expression
(); }
913 memspec_opt memspec_at_opt phdr_opt fill_opt
916 lang_leave_output_section_statement
($16, $13, $15, $14);
921 { ldlex_expression
(); }
922 opt_exp_without_type opt_nocrossrefs opt_at opt_subalign
923 { ldlex_popstate
(); ldlex_script
(); }
926 lang_enter_overlay
($3, $6);
930 { ldlex_popstate
(); ldlex_expression
(); }
931 memspec_opt memspec_at_opt phdr_opt fill_opt
934 lang_leave_overlay
($5, (int) $4,
938 |
/* The GROUP case is just enough to support the gcc
939 svr3.ifile script. It is not intended to be full
940 support. I'm not even sure what GROUP is supposed
942 GROUP
{ ldlex_expression
(); }
946 lang_add_assignment
(exp_assop
('=', ".", $3));
948 '{' sec_or_group_p1
'}'
952 NOLOAD
{ sectype
= noload_section
; }
953 | DSECT
{ sectype
= dsect_section
; }
954 | COPY
{ sectype
= copy_section
; }
955 | INFO
{ sectype
= info_section
; }
956 | OVERLAY
{ sectype
= overlay_section
; }
961 |
/* EMPTY */ { sectype
= normal_section
; }
962 |
'(' ')' { sectype
= normal_section
; }
966 exp atype
':' { $$
= $1; }
967 | atype
':' { $$
= (etree_type
*)NULL
; }
968 |
/* The BIND cases are to support the gcc svr3.ifile
969 script. They aren't intended to implement full
970 support for the BIND keyword. I'm not even sure
971 what BIND is supposed to mean. */
972 BIND
'(' exp
')' atype
':' { $$
= $3; }
973 | BIND
'(' exp
')' BLOCK
'(' exp
')' atype
':'
977 opt_exp_without_type:
979 |
':' { $$
= (etree_type
*) NULL
; }
992 |
{ $$
= DEFAULT_MEMORY_REGION
; }
1002 struct lang_output_section_phdr_list
*n
;
1004 n
= ((struct lang_output_section_phdr_list
*)
1005 xmalloc
(sizeof
*n
));
1019 lang_enter_overlay_section
($2);
1021 '{' statement_list_opt
'}'
1022 { ldlex_popstate
(); ldlex_expression
(); }
1026 lang_leave_overlay_section
($9, $8);
1032 PHDRS
'{' phdr_list
'}'
1041 NAME
{ ldlex_expression
(); }
1042 phdr_type phdr_qualifiers
{ ldlex_popstate
(); }
1045 lang_new_phdr
($1, $3, $4.filehdr
, $4.phdrs
, $4.at
,
1055 if
($1->type.node_class
== etree_name
1056 && $1->type.node_code
== NAME
)
1060 static const char * const phdr_types
[] =
1062 "PT_NULL", "PT_LOAD", "PT_DYNAMIC",
1063 "PT_INTERP", "PT_NOTE", "PT_SHLIB",
1069 i
< sizeof phdr_types
/ sizeof phdr_types
[0];
1071 if
(strcmp
(s
, phdr_types
[i
]) == 0)
1076 if
(i
== sizeof phdr_types
/ sizeof phdr_types
[0])
1078 if
(strcmp
(s
, "PT_GNU_EH_FRAME") == 0)
1079 $$
= exp_intop
(0x6474e550);
1080 else if
(strcmp
(s
, "PT_GNU_STACK") == 0)
1081 $$
= exp_intop
(0x6474e551);
1085 %X%P:%S: unknown phdr type `%s' (try integer literal)\n"),
1097 memset
(&$$
, 0, sizeof
(struct phdr_info
));
1099 | NAME phdr_val phdr_qualifiers
1102 if
(strcmp
($1, "FILEHDR") == 0 && $2 == NULL
)
1104 else if
(strcmp
($1, "PHDRS") == 0 && $2 == NULL
)
1106 else if
(strcmp
($1, "FLAGS") == 0 && $2 != NULL
)
1109 einfo
(_
("%X%P:%S: PHDRS syntax error at `%s'\n"), $1);
1111 | AT
'(' exp
')' phdr_qualifiers
1129 /* This syntax is used within an external version script file. */
1131 version_script_file:
1133 ldlex_version_file
();
1134 PUSH_ERROR
(_
("VERSION script"));
1143 /* This is used within a normal linker script file. */
1147 ldlex_version_script
();
1149 VERSIONK
'{' vers_nodes
'}'
1157 | vers_nodes vers_node
1161 '{' vers_tag
'}' ';'
1163 lang_register_vers_node
(NULL
, $2, NULL
);
1165 | VERS_TAG
'{' vers_tag
'}' ';'
1167 lang_register_vers_node
($1, $3, NULL
);
1169 | VERS_TAG
'{' vers_tag
'}' verdep
';'
1171 lang_register_vers_node
($1, $3, $5);
1178 $$
= lang_add_vers_depend
(NULL
, $1);
1182 $$
= lang_add_vers_depend
($1, $2);
1189 $$
= lang_new_vers_node
(NULL
, NULL
);
1193 $$
= lang_new_vers_node
($1, NULL
);
1195 | GLOBAL
':' vers_defns
';'
1197 $$
= lang_new_vers_node
($3, NULL
);
1199 | LOCAL
':' vers_defns
';'
1201 $$
= lang_new_vers_node
(NULL
, $3);
1203 | GLOBAL
':' vers_defns
';' LOCAL
':' vers_defns
';'
1205 $$
= lang_new_vers_node
($3, $7);
1212 $$
= lang_new_vers_pattern
(NULL
, $1, ldgram_vers_current_lang
);
1214 | vers_defns
';' VERS_IDENTIFIER
1216 $$
= lang_new_vers_pattern
($1, $3, ldgram_vers_current_lang
);
1218 | vers_defns
';' EXTERN NAME
'{'
1220 $
<name
>$
= ldgram_vers_current_lang
;
1221 ldgram_vers_current_lang
= $4;
1223 vers_defns opt_semicolon
'}'
1226 ldgram_vers_current_lang
= $
<name
>6;
1230 $
<name
>$
= ldgram_vers_current_lang
;
1231 ldgram_vers_current_lang
= $2;
1233 vers_defns opt_semicolon
'}'
1236 ldgram_vers_current_lang
= $
<name
>4;
1250 if
(ldfile_assumed_script
)
1251 einfo
(_
("%P:%s: file format not recognized; treating as linker script\n"),
1252 ldfile_input_filename
);
1253 if
(error_index
> 0 && error_index
< ERROR_NAME_MAX
)
1254 einfo
("%P%F:%S: %s in %s\n", arg
, error_names
[error_index
-1]);
1256 einfo
("%P%F:%S: %s\n", arg
);