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 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 opt_align
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 PROVIDE_HIDDEN 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
156 %type
<versyms
> vers_defns
157 %type
<versnode
> vers_tag
158 %type
<deflist
> verdep
159 %token INPUT_DYNAMIC_LIST
164 INPUT_SCRIPT script_file
165 | INPUT_MRI_SCRIPT mri_script_file
166 | INPUT_VERSION_SCRIPT version_script_file
167 | INPUT_DYNAMIC_LIST dynamic_list_file
168 | INPUT_DEFSYM defsym_expr
180 lang_add_assignment
(exp_assop
($3,$2,$4));
184 /* SYNTAX WITHIN AN MRI SCRIPT FILE */
188 PUSH_ERROR
(_
("MRI style script"));
199 mri_script_lines mri_script_command NEWLINE
207 einfo
(_
("%P%F: unrecognised keyword in MRI style script '%s'\n"),$1);
210 config.map_filename
= "-";
212 | ORDER ordernamelist
214 | PUBLIC NAME
'=' exp
215 { mri_public
($2, $4); }
216 | PUBLIC NAME
',' exp
217 { mri_public
($2, $4); }
219 { mri_public
($2, $3); }
223 { mri_output_section
($2, $4);}
225 { mri_output_section
($2, $3);}
227 { mri_output_section
($2, $4);}
228 | ALIGN_K NAME
'=' exp
229 { mri_align
($2,$4); }
230 | ALIGN_K NAME
',' exp
231 { mri_align
($2,$4); }
232 | ALIGNMOD NAME
'=' exp
233 { mri_alignmod
($2,$4); }
234 | ALIGNMOD NAME
',' exp
235 { mri_alignmod
($2,$4); }
236 | ABSOLUTE mri_abs_name_list
237 | LOAD mri_load_name_list
240 | ALIAS NAME
',' NAME
241 { mri_alias
($2,$4,0);}
243 { mri_alias
($2, 0, (int) $4.integer
); }
247 { mri_truncate
((unsigned int) $2.integer
); }
249 | EXTERN extern_name_list
251 { ldlex_script
(); ldfile_open_command_file
($2); }
253 { ldlex_popstate
(); }
255 { lang_add_entry
($2, FALSE
); }
260 ordernamelist
',' NAME
{ mri_order
($3); }
261 | ordernamelist NAME
{ mri_order
($2); }
268 | mri_load_name_list
',' NAME
{ mri_load
($3); }
273 { mri_only_load
($1); }
274 | mri_abs_name_list
',' NAME
275 { mri_only_load
($3); }
279 /* empty */ { $$
= NULL
; }
281 | casesymlist
',' NAME
286 { ldlang_add_undef
($1); }
287 | extern_name_list NAME
288 { ldlang_add_undef
($2); }
289 | extern_name_list
',' NAME
290 { ldlang_add_undef
($3); }
318 | floating_point_support
322 | TARGET_K
'(' NAME
')'
323 { lang_add_target
($3); }
324 | SEARCH_DIR
'(' filename
')'
325 { ldfile_add_library_path
($3, FALSE
); }
326 | OUTPUT
'(' filename
')'
327 { lang_add_output
($3, 1); }
328 | OUTPUT_FORMAT
'(' NAME
')'
329 { lang_add_output_format
($3, (char *) NULL
,
331 | OUTPUT_FORMAT
'(' NAME
',' NAME
',' NAME
')'
332 { lang_add_output_format
($3, $5, $7, 1); }
333 | OUTPUT_ARCH
'(' NAME
')'
334 { ldfile_set_output_arch
($3, bfd_arch_unknown
); }
335 | FORCE_COMMON_ALLOCATION
336 { command_line.force_common_definition
= TRUE
; }
337 | INHIBIT_COMMON_ALLOCATION
338 { command_line.inhibit_common_definition
= TRUE
; }
339 | INPUT
'(' input_list
')'
341 { lang_enter_group
(); }
343 { lang_leave_group
(); }
344 | MAP
'(' filename
')'
345 { lang_add_map
($3); }
347 { ldlex_script
(); ldfile_open_command_file
($2); }
349 { ldlex_popstate
(); }
350 | NOCROSSREFS
'(' nocrossref_list
')'
352 lang_add_nocrossref
($3);
354 | EXTERN
'(' extern_name_list
')'
359 { lang_add_input_file
($1,lang_input_file_is_search_file_enum
,
361 | input_list
',' NAME
362 { lang_add_input_file
($3,lang_input_file_is_search_file_enum
,
365 { lang_add_input_file
($2,lang_input_file_is_search_file_enum
,
368 { lang_add_input_file
($1,lang_input_file_is_l_enum
,
370 | input_list
',' LNAME
371 { lang_add_input_file
($3,lang_input_file_is_l_enum
,
374 { lang_add_input_file
($2,lang_input_file_is_l_enum
,
377 { $
<integer
>$
= as_needed
; as_needed
= TRUE
; }
379 { as_needed
= $
<integer
>3; }
380 | input_list
',' AS_NEEDED
'('
381 { $
<integer
>$
= as_needed
; as_needed
= TRUE
; }
383 { as_needed
= $
<integer
>5; }
384 | input_list AS_NEEDED
'('
385 { $
<integer
>$
= as_needed
; as_needed
= TRUE
; }
387 { as_needed
= $
<integer
>4; }
391 SECTIONS
'{' sec_or_group_p1
'}'
395 sec_or_group_p1 section
396 | sec_or_group_p1 statement_anywhere
402 { lang_add_entry
($3, FALSE
); }
404 | ASSERT_K
{ldlex_expression
();} '(' exp
',' NAME
')'
406 lang_add_assignment
(exp_assert
($4, $6)); }
409 /* The '*' and '?' cases are there because the lexer returns them as
410 separate tokens rather than as NAME. */
431 $$.exclude_name_list
= NULL
;
433 | EXCLUDE_FILE
'(' exclude_name_list
')' wildcard_name
437 $$.exclude_name_list
= $3;
439 | SORT_BY_NAME
'(' wildcard_name
')'
443 $$.exclude_name_list
= NULL
;
445 | SORT_BY_ALIGNMENT
'(' wildcard_name
')'
448 $$.sorted
= by_alignment
;
449 $$.exclude_name_list
= NULL
;
451 | SORT_BY_NAME
'(' SORT_BY_ALIGNMENT
'(' wildcard_name
')' ')'
454 $$.sorted
= by_name_alignment
;
455 $$.exclude_name_list
= NULL
;
457 | SORT_BY_NAME
'(' SORT_BY_NAME
'(' wildcard_name
')' ')'
461 $$.exclude_name_list
= NULL
;
463 | SORT_BY_ALIGNMENT
'(' SORT_BY_NAME
'(' wildcard_name
')' ')'
466 $$.sorted
= by_alignment_name
;
467 $$.exclude_name_list
= NULL
;
469 | SORT_BY_ALIGNMENT
'(' SORT_BY_ALIGNMENT
'(' wildcard_name
')' ')'
472 $$.sorted
= by_alignment
;
473 $$.exclude_name_list
= NULL
;
475 | SORT_BY_NAME
'(' EXCLUDE_FILE
'(' exclude_name_list
')' wildcard_name
')'
479 $$.exclude_name_list
= $5;
484 exclude_name_list wildcard_name
486 struct name_list
*tmp
;
487 tmp
= (struct name_list
*) xmalloc
(sizeof
*tmp
);
495 struct name_list
*tmp
;
496 tmp
= (struct name_list
*) xmalloc
(sizeof
*tmp
);
504 file_NAME_list opt_comma wildcard_spec
506 struct wildcard_list
*tmp
;
507 tmp
= (struct wildcard_list
*) xmalloc
(sizeof
*tmp
);
515 struct wildcard_list
*tmp
;
516 tmp
= (struct wildcard_list
*) xmalloc
(sizeof
*tmp
);
523 input_section_spec_no_keep:
526 struct wildcard_spec tmp
;
528 tmp.exclude_name_list
= NULL
;
530 lang_add_wild
(&tmp
, NULL
, ldgram_had_keep
);
532 |
'[' file_NAME_list
']'
534 lang_add_wild
(NULL
, $2, ldgram_had_keep
);
536 | wildcard_spec
'(' file_NAME_list
')'
538 lang_add_wild
(&$1, $3, ldgram_had_keep
);
543 input_section_spec_no_keep
545 { ldgram_had_keep
= TRUE
; }
546 input_section_spec_no_keep
')'
547 { ldgram_had_keep
= FALSE
; }
552 | CREATE_OBJECT_SYMBOLS
554 lang_add_attribute
(lang_object_symbols_statement_enum
);
560 lang_add_attribute
(lang_constructors_statement_enum
);
562 | SORT_BY_NAME
'(' CONSTRUCTORS
')'
564 constructors_sorted
= TRUE
;
565 lang_add_attribute
(lang_constructors_statement_enum
);
568 | length
'(' mustbe_exp
')'
570 lang_add_data
((int) $1, $3);
573 | FILL
'(' fill_exp
')'
580 statement_list statement
605 $$
= exp_get_fill
($1, 0, "fill value");
612 |
{ $$
= (fill_type
*) 0; }
642 lang_add_assignment
(exp_assop
($2, $1, $3));
644 | NAME assign_op mustbe_exp
646 lang_add_assignment
(exp_assop
('=', $1,
652 | PROVIDE
'(' NAME
'=' mustbe_exp
')'
654 lang_add_assignment
(exp_provide
($3, $5, FALSE
));
656 | PROVIDE_HIDDEN
'(' NAME
'=' mustbe_exp
')'
658 lang_add_assignment
(exp_provide
($3, $5, TRUE
));
668 MEMORY
'{' memory_spec memory_spec_list
'}'
672 memory_spec_list memory_spec
673 | memory_spec_list
',' memory_spec
679 { region
= lang_memory_region_lookup
($1, TRUE
); }
681 origin_spec opt_comma length_spec
686 ORIGIN
'=' mustbe_exp
688 region
->origin
= exp_get_vma
($3, 0, "origin");
689 region
->current
= region
->origin
;
694 LENGTH
'=' mustbe_exp
696 region
->length
= exp_get_vma
($3, -1, "length");
702 { /* dummy action to avoid bison 1.25 error message */ }
703 |
'(' attributes_list
')'
708 | attributes_list attributes_string
713 { lang_set_flags
(region
, $1, 0); }
715 { lang_set_flags
(region
, $2, 1); }
719 STARTUP
'(' filename
')'
720 { lang_startup
($3); }
724 HLL
'(' high_level_library_NAME_list
')'
726 { ldemul_hll
((char *)NULL
); }
729 high_level_library_NAME_list:
730 high_level_library_NAME_list opt_comma filename
738 SYSLIB
'(' low_level_library_NAME_list
')'
739 ; low_level_library_NAME_list
:
740 low_level_library_NAME_list opt_comma filename
741 { ldemul_syslib
($3); }
745 floating_point_support:
747 { lang_float
(TRUE
); }
749 { lang_float
(FALSE
); }
757 | NAME nocrossref_list
759 struct lang_nocrossref
*n
;
761 n
= (struct lang_nocrossref
*) xmalloc
(sizeof
*n
);
766 | NAME
',' nocrossref_list
768 struct lang_nocrossref
*n
;
770 n
= (struct lang_nocrossref
*) xmalloc
(sizeof
*n
);
777 mustbe_exp: { ldlex_expression
(); }
779 { ldlex_popstate
(); $$
=$2;}
784 { $$
= exp_unop
('-', $2); }
787 | NEXT
'(' exp
')' %prec UNARY
788 { $$
= exp_unop
((int) $1,$3); }
789 |
'!' exp %prec UNARY
790 { $$
= exp_unop
('!', $2); }
791 |
'+' exp %prec UNARY
793 |
'~' exp %prec UNARY
794 { $$
= exp_unop
('~', $2);}
797 { $$
= exp_binop
('*', $1, $3); }
799 { $$
= exp_binop
('/', $1, $3); }
801 { $$
= exp_binop
('%', $1, $3); }
803 { $$
= exp_binop
('+', $1, $3); }
805 { $$
= exp_binop
('-' , $1, $3); }
807 { $$
= exp_binop
(LSHIFT
, $1, $3); }
809 { $$
= exp_binop
(RSHIFT
, $1, $3); }
811 { $$
= exp_binop
(EQ
, $1, $3); }
813 { $$
= exp_binop
(NE
, $1, $3); }
815 { $$
= exp_binop
(LE
, $1, $3); }
817 { $$
= exp_binop
(GE
, $1, $3); }
819 { $$
= exp_binop
('<' , $1, $3); }
821 { $$
= exp_binop
('>' , $1, $3); }
823 { $$
= exp_binop
('&' , $1, $3); }
825 { $$
= exp_binop
('^' , $1, $3); }
827 { $$
= exp_binop
('|' , $1, $3); }
828 | exp
'?' exp
':' exp
829 { $$
= exp_trinop
('?' , $1, $3, $5); }
831 { $$
= exp_binop
(ANDAND
, $1, $3); }
833 { $$
= exp_binop
(OROR
, $1, $3); }
834 | DEFINED
'(' NAME
')'
835 { $$
= exp_nameop
(DEFINED
, $3); }
837 { $$
= exp_bigintop
($1.integer
, $1.str
); }
839 { $$
= exp_nameop
(SIZEOF_HEADERS
,0); }
841 | SIZEOF
'(' NAME
')'
842 { $$
= exp_nameop
(SIZEOF
,$3); }
844 { $$
= exp_nameop
(ADDR
,$3); }
845 | LOADADDR
'(' NAME
')'
846 { $$
= exp_nameop
(LOADADDR
,$3); }
847 | CONSTANT
'(' NAME
')'
848 { $$
= exp_nameop
(CONSTANT
,$3); }
849 | ABSOLUTE
'(' exp
')'
850 { $$
= exp_unop
(ABSOLUTE
, $3); }
851 | ALIGN_K
'(' exp
')'
852 { $$
= exp_unop
(ALIGN_K
,$3); }
853 | ALIGN_K
'(' exp
',' exp
')'
854 { $$
= exp_binop
(ALIGN_K
,$3,$5); }
855 | DATA_SEGMENT_ALIGN
'(' exp
',' exp
')'
856 { $$
= exp_binop
(DATA_SEGMENT_ALIGN
, $3, $5); }
857 | DATA_SEGMENT_RELRO_END
'(' exp
',' exp
')'
858 { $$
= exp_binop
(DATA_SEGMENT_RELRO_END
, $5, $3); }
859 | DATA_SEGMENT_END
'(' exp
')'
860 { $$
= exp_unop
(DATA_SEGMENT_END
, $3); }
861 | SEGMENT_START
'(' NAME
',' exp
')'
862 { /* The operands to the expression node are
863 placed in the opposite order from the way
864 in which they appear in the script as
865 that allows us to reuse more code in
867 $$
= exp_binop
(SEGMENT_START
,
869 exp_nameop
(NAME
, $3)); }
871 { $$
= exp_unop
(ALIGN_K
,$3); }
873 { $$
= exp_nameop
(NAME
,$1); }
874 | MAX_K
'(' exp
',' exp
')'
875 { $$
= exp_binop
(MAX_K
, $3, $5 ); }
876 | MIN_K
'(' exp
',' exp
')'
877 { $$
= exp_binop
(MIN_K
, $3, $5 ); }
878 | ASSERT_K
'(' exp
',' NAME
')'
879 { $$
= exp_assert
($3, $5); }
880 | ORIGIN
'(' NAME
')'
881 { $$
= exp_nameop
(ORIGIN
, $3); }
882 | LENGTH
'(' NAME
')'
883 { $$
= exp_nameop
(LENGTH
, $3); }
888 AT
'>' NAME
{ $$
= $3; }
893 AT
'(' exp
')' { $$
= $3; }
898 ALIGN_K
'(' exp
')' { $$
= $3; }
903 SUBALIGN
'(' exp
')' { $$
= $3; }
908 ONLY_IF_RO
{ $$
= ONLY_IF_RO
; }
909 | ONLY_IF_RW
{ $$
= ONLY_IF_RW
; }
910 | SPECIAL
{ $$
= SPECIAL
; }
914 section: NAME
{ ldlex_expression
(); }
918 opt_subalign
{ ldlex_popstate
(); ldlex_script
(); }
922 lang_enter_output_section_statement
($1, $3,
927 '}' { ldlex_popstate
(); ldlex_expression
(); }
928 memspec_opt memspec_at_opt phdr_opt fill_opt
931 lang_leave_output_section_statement
($17, $14, $16, $15);
936 { ldlex_expression
(); }
937 opt_exp_without_type opt_nocrossrefs opt_at opt_subalign
938 { ldlex_popstate
(); ldlex_script
(); }
941 lang_enter_overlay
($3, $6);
945 { ldlex_popstate
(); ldlex_expression
(); }
946 memspec_opt memspec_at_opt phdr_opt fill_opt
949 lang_leave_overlay
($5, (int) $4,
953 |
/* The GROUP case is just enough to support the gcc
954 svr3.ifile script. It is not intended to be full
955 support. I'm not even sure what GROUP is supposed
957 GROUP
{ ldlex_expression
(); }
961 lang_add_assignment
(exp_assop
('=', ".", $3));
963 '{' sec_or_group_p1
'}'
967 NOLOAD
{ sectype
= noload_section
; }
968 | DSECT
{ sectype
= noalloc_section
; }
969 | COPY
{ sectype
= noalloc_section
; }
970 | INFO
{ sectype
= noalloc_section
; }
971 | OVERLAY
{ sectype
= noalloc_section
; }
976 |
/* EMPTY */ { sectype
= normal_section
; }
977 |
'(' ')' { sectype
= normal_section
; }
981 exp atype
':' { $$
= $1; }
982 | atype
':' { $$
= (etree_type
*)NULL
; }
983 |
/* The BIND cases are to support the gcc svr3.ifile
984 script. They aren't intended to implement full
985 support for the BIND keyword. I'm not even sure
986 what BIND is supposed to mean. */
987 BIND
'(' exp
')' atype
':' { $$
= $3; }
988 | BIND
'(' exp
')' BLOCK
'(' exp
')' atype
':'
992 opt_exp_without_type:
994 |
':' { $$
= (etree_type
*) NULL
; }
1007 |
{ $$
= DEFAULT_MEMORY_REGION
; }
1017 struct lang_output_section_phdr_list
*n
;
1019 n
= ((struct lang_output_section_phdr_list
*)
1020 xmalloc
(sizeof
*n
));
1034 lang_enter_overlay_section
($2);
1036 '{' statement_list_opt
'}'
1037 { ldlex_popstate
(); ldlex_expression
(); }
1041 lang_leave_overlay_section
($9, $8);
1047 PHDRS
'{' phdr_list
'}'
1056 NAME
{ ldlex_expression
(); }
1057 phdr_type phdr_qualifiers
{ ldlex_popstate
(); }
1060 lang_new_phdr
($1, $3, $4.filehdr
, $4.phdrs
, $4.at
,
1070 if
($1->type.node_class
== etree_name
1071 && $1->type.node_code
== NAME
)
1075 static const char * const phdr_types
[] =
1077 "PT_NULL", "PT_LOAD", "PT_DYNAMIC",
1078 "PT_INTERP", "PT_NOTE", "PT_SHLIB",
1084 i
< sizeof phdr_types
/ sizeof phdr_types
[0];
1086 if
(strcmp
(s
, phdr_types
[i
]) == 0)
1091 if
(i
== sizeof phdr_types
/ sizeof phdr_types
[0])
1093 if
(strcmp
(s
, "PT_GNU_EH_FRAME") == 0)
1094 $$
= exp_intop
(0x6474e550);
1095 else if
(strcmp
(s
, "PT_GNU_STACK") == 0)
1096 $$
= exp_intop
(0x6474e551);
1100 %X%P:%S: unknown phdr type `%s' (try integer literal)\n"),
1112 memset
(&$$
, 0, sizeof
(struct phdr_info
));
1114 | NAME phdr_val phdr_qualifiers
1117 if
(strcmp
($1, "FILEHDR") == 0 && $2 == NULL
)
1119 else if
(strcmp
($1, "PHDRS") == 0 && $2 == NULL
)
1121 else if
(strcmp
($1, "FLAGS") == 0 && $2 != NULL
)
1124 einfo
(_
("%X%P:%S: PHDRS syntax error at `%s'\n"), $1);
1126 | AT
'(' exp
')' phdr_qualifiers
1146 ldlex_version_file
();
1147 PUSH_ERROR
(_
("dynamic list"));
1158 | dynamic_list_nodes dynamic_list_node
1162 '{' dynamic_list_tag
'}' ';'
1168 lang_append_dynamic_list
($1);
1172 /* This syntax is used within an external version script file. */
1174 version_script_file:
1176 ldlex_version_file
();
1177 PUSH_ERROR
(_
("VERSION script"));
1186 /* This is used within a normal linker script file. */
1190 ldlex_version_script
();
1192 VERSIONK
'{' vers_nodes
'}'
1200 | vers_nodes vers_node
1204 '{' vers_tag
'}' ';'
1206 lang_register_vers_node
(NULL
, $2, NULL
);
1208 | VERS_TAG
'{' vers_tag
'}' ';'
1210 lang_register_vers_node
($1, $3, NULL
);
1212 | VERS_TAG
'{' vers_tag
'}' verdep
';'
1214 lang_register_vers_node
($1, $3, $5);
1221 $$
= lang_add_vers_depend
(NULL
, $1);
1225 $$
= lang_add_vers_depend
($1, $2);
1232 $$
= lang_new_vers_node
(NULL
, NULL
);
1236 $$
= lang_new_vers_node
($1, NULL
);
1238 | GLOBAL
':' vers_defns
';'
1240 $$
= lang_new_vers_node
($3, NULL
);
1242 | LOCAL
':' vers_defns
';'
1244 $$
= lang_new_vers_node
(NULL
, $3);
1246 | GLOBAL
':' vers_defns
';' LOCAL
':' vers_defns
';'
1248 $$
= lang_new_vers_node
($3, $7);
1255 $$
= lang_new_vers_pattern
(NULL
, $1, ldgram_vers_current_lang
, FALSE
);
1259 $$
= lang_new_vers_pattern
(NULL
, $1, ldgram_vers_current_lang
, TRUE
);
1261 | vers_defns
';' VERS_IDENTIFIER
1263 $$
= lang_new_vers_pattern
($1, $3, ldgram_vers_current_lang
, FALSE
);
1265 | vers_defns
';' NAME
1267 $$
= lang_new_vers_pattern
($1, $3, ldgram_vers_current_lang
, TRUE
);
1269 | vers_defns
';' EXTERN NAME
'{'
1271 $
<name
>$
= ldgram_vers_current_lang
;
1272 ldgram_vers_current_lang
= $4;
1274 vers_defns opt_semicolon
'}'
1276 struct bfd_elf_version_expr
*pat
;
1277 for
(pat
= $7; pat
->next
!= NULL
; pat
= pat
->next
);
1280 ldgram_vers_current_lang
= $
<name
>6;
1284 $
<name
>$
= ldgram_vers_current_lang
;
1285 ldgram_vers_current_lang
= $2;
1287 vers_defns opt_semicolon
'}'
1290 ldgram_vers_current_lang
= $
<name
>4;
1294 $$
= lang_new_vers_pattern
(NULL
, "global", ldgram_vers_current_lang
, FALSE
);
1296 | vers_defns
';' GLOBAL
1298 $$
= lang_new_vers_pattern
($1, "global", ldgram_vers_current_lang
, FALSE
);
1302 $$
= lang_new_vers_pattern
(NULL
, "local", ldgram_vers_current_lang
, FALSE
);
1304 | vers_defns
';' LOCAL
1306 $$
= lang_new_vers_pattern
($1, "local", ldgram_vers_current_lang
, FALSE
);
1310 $$
= lang_new_vers_pattern
(NULL
, "extern", ldgram_vers_current_lang
, FALSE
);
1312 | vers_defns
';' EXTERN
1314 $$
= lang_new_vers_pattern
($1, "extern", ldgram_vers_current_lang
, FALSE
);
1328 if
(ldfile_assumed_script
)
1329 einfo
(_
("%P:%s: file format not recognized; treating as linker script\n"),
1330 ldfile_input_filename
);
1331 if
(error_index
> 0 && error_index
< ERROR_NAME_MAX
)
1332 einfo
("%P%F:%S: %s in %s\n", arg
, error_names
[error_index
-1]);
1334 einfo
("%P%F:%S: %s\n", arg
);