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, 2009 Free Software Foundation, Inc.
4 Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
6 This file is part of the GNU Binutils.
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 3 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,
21 MA 02110-1301, USA. */
28 #define DONTDECLARE_MALLOC
49 static enum section_type sectype
;
50 static lang_memory_region_type
*region
;
52 bfd_boolean ldgram_had_keep
= FALSE
;
53 char *ldgram_vers_current_lang
= NULL
;
55 #define ERROR_NAME_MAX 20
56 static char *error_names
[ERROR_NAME_MAX
];
57 static int error_index
;
58 #define PUSH_ERROR(x) if (error_index < ERROR_NAME_MAX) error_names[error_index] = x; error_index++;
59 #define POP_ERROR() error_index--;
71 struct wildcard_spec wildcard
;
72 struct wildcard_list
*wildcard_list
;
73 struct name_list
*name_list
;
75 union etree_union
*etree
;
80 union etree_union
*at
;
81 union etree_union
*flags
;
83 struct lang_nocrossref
*nocrossref
;
84 struct lang_output_section_phdr_list
*section_phdr
;
85 struct bfd_elf_version_deps
*deflist
;
86 struct bfd_elf_version_expr
*versyms
;
87 struct bfd_elf_version_tree
*versnode
;
90 %type
<etree
> exp opt_exp_with_type mustbe_exp opt_at phdr_type phdr_val
91 %type
<etree
> opt_exp_without_type opt_subalign opt_align
92 %type
<fill
> fill_opt fill_exp
93 %type
<name_list
> exclude_name_list
94 %type
<wildcard_list
> file_NAME_list
95 %type
<name
> memspec_opt casesymlist
96 %type
<name
> memspec_at_opt
97 %type
<cname
> wildcard_name
98 %type
<wildcard
> wildcard_spec
100 %token
<name
> NAME LNAME
101 %type
<integer
> length
102 %type
<phdr
> phdr_qualifiers
103 %type
<nocrossref
> nocrossref_list
104 %type
<section_phdr
> phdr_opt
105 %type
<integer
> opt_nocrossrefs
107 %right
<token
> PLUSEQ MINUSEQ MULTEQ DIVEQ
'=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ
108 %right
<token
> '?' ':'
115 %left
<token
> '<' '>' LE GE
116 %left
<token
> LSHIFT RSHIFT
118 %left
<token
> '+' '-'
119 %left
<token
> '*' '/' '%'
124 %token
<token
> ALIGN_K BLOCK BIND QUAD SQUAD LONG SHORT BYTE
125 %token SECTIONS PHDRS INSERT_K AFTER BEFORE
126 %token DATA_SEGMENT_ALIGN DATA_SEGMENT_RELRO_END DATA_SEGMENT_END
127 %token SORT_BY_NAME SORT_BY_ALIGNMENT
129 %token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH
130 %token INHIBIT_COMMON_ALLOCATION
135 %token NOLOAD DSECT COPY INFO OVERLAY
136 %token DEFINED TARGET_K SEARCH_DIR MAP ENTRY
137 %token
<integer
> NEXT
138 %token SIZEOF ALIGNOF ADDR LOADADDR MAX_K MIN_K
139 %token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS
141 %token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS
142 %token ALIGNMOD AT SUBALIGN PROVIDE PROVIDE_HIDDEN AS_NEEDED
143 %type
<token
> assign_op atype attributes_opt sect_constraint
144 %type
<name
> filename
145 %token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD ASSERT_K
146 %token FORMAT PUBLIC DEFSYMEND BASE ALIAS TRUNCATE REL
147 %token INPUT_SCRIPT INPUT_MRI_SCRIPT INPUT_DEFSYM CASE EXTERN START
148 %token
<name
> VERS_TAG VERS_IDENTIFIER
149 %token GLOBAL LOCAL VERSIONK INPUT_VERSION_SCRIPT
150 %token KEEP ONLY_IF_RO ONLY_IF_RW SPECIAL
153 %type
<versyms
> vers_defns
154 %type
<versnode
> vers_tag
155 %type
<deflist
> verdep
156 %token INPUT_DYNAMIC_LIST
161 INPUT_SCRIPT script_file
162 | INPUT_MRI_SCRIPT mri_script_file
163 | INPUT_VERSION_SCRIPT version_script_file
164 | INPUT_DYNAMIC_LIST dynamic_list_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
281 /* Parsed as expressions so that commas separate entries */
283 { ldlex_expression
(); }
284 extern_name_list_body
285 { ldlex_popstate
(); }
287 extern_name_list_body:
289 { ldlang_add_undef
($1); }
290 | extern_name_list_body NAME
291 { ldlang_add_undef
($2); }
292 | extern_name_list_body
',' NAME
293 { ldlang_add_undef
($3); }
299 { ldlex_popstate
(); }
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
')'
352 | INSERT_K AFTER NAME
353 { lang_add_insert
($3, 0); }
354 | INSERT_K BEFORE NAME
355 { lang_add_insert
($3, 1); }
356 | REGION_ALIAS
'(' NAME
',' NAME
')'
357 { lang_memory_region_alias
($3, $5); }
362 { lang_add_input_file
($1,lang_input_file_is_search_file_enum
,
364 | input_list
',' NAME
365 { lang_add_input_file
($3,lang_input_file_is_search_file_enum
,
368 { lang_add_input_file
($2,lang_input_file_is_search_file_enum
,
371 { lang_add_input_file
($1,lang_input_file_is_l_enum
,
373 | input_list
',' LNAME
374 { lang_add_input_file
($3,lang_input_file_is_l_enum
,
377 { lang_add_input_file
($2,lang_input_file_is_l_enum
,
380 { $
<integer
>$
= as_needed
; as_needed
= TRUE
; }
382 { as_needed
= $
<integer
>3; }
383 | input_list
',' AS_NEEDED
'('
384 { $
<integer
>$
= as_needed
; as_needed
= TRUE
; }
386 { as_needed
= $
<integer
>5; }
387 | input_list AS_NEEDED
'('
388 { $
<integer
>$
= as_needed
; as_needed
= TRUE
; }
390 { as_needed
= $
<integer
>4; }
394 SECTIONS
'{' sec_or_group_p1
'}'
398 sec_or_group_p1 section
399 | sec_or_group_p1 statement_anywhere
405 { lang_add_entry
($3, FALSE
); }
407 | ASSERT_K
{ldlex_expression
();} '(' exp
',' NAME
')'
409 lang_add_assignment
(exp_assert
($4, $6)); }
412 /* The '*' and '?' cases are there because the lexer returns them as
413 separate tokens rather than as NAME. */
434 $$.exclude_name_list
= NULL
;
436 | EXCLUDE_FILE
'(' exclude_name_list
')' wildcard_name
440 $$.exclude_name_list
= $3;
442 | SORT_BY_NAME
'(' wildcard_name
')'
446 $$.exclude_name_list
= NULL
;
448 | SORT_BY_ALIGNMENT
'(' wildcard_name
')'
451 $$.sorted
= by_alignment
;
452 $$.exclude_name_list
= NULL
;
454 | SORT_BY_NAME
'(' SORT_BY_ALIGNMENT
'(' wildcard_name
')' ')'
457 $$.sorted
= by_name_alignment
;
458 $$.exclude_name_list
= NULL
;
460 | SORT_BY_NAME
'(' SORT_BY_NAME
'(' wildcard_name
')' ')'
464 $$.exclude_name_list
= NULL
;
466 | SORT_BY_ALIGNMENT
'(' SORT_BY_NAME
'(' wildcard_name
')' ')'
469 $$.sorted
= by_alignment_name
;
470 $$.exclude_name_list
= NULL
;
472 | SORT_BY_ALIGNMENT
'(' SORT_BY_ALIGNMENT
'(' wildcard_name
')' ')'
475 $$.sorted
= by_alignment
;
476 $$.exclude_name_list
= NULL
;
478 | SORT_BY_NAME
'(' EXCLUDE_FILE
'(' exclude_name_list
')' wildcard_name
')'
482 $$.exclude_name_list
= $5;
487 exclude_name_list wildcard_name
489 struct name_list
*tmp
;
490 tmp
= (struct name_list
*) xmalloc
(sizeof
*tmp
);
498 struct name_list
*tmp
;
499 tmp
= (struct name_list
*) xmalloc
(sizeof
*tmp
);
507 file_NAME_list opt_comma wildcard_spec
509 struct wildcard_list
*tmp
;
510 tmp
= (struct wildcard_list
*) xmalloc
(sizeof
*tmp
);
518 struct wildcard_list
*tmp
;
519 tmp
= (struct wildcard_list
*) xmalloc
(sizeof
*tmp
);
526 input_section_spec_no_keep:
529 struct wildcard_spec tmp
;
531 tmp.exclude_name_list
= NULL
;
533 lang_add_wild
(&tmp
, NULL
, ldgram_had_keep
);
535 |
'[' file_NAME_list
']'
537 lang_add_wild
(NULL
, $2, ldgram_had_keep
);
539 | wildcard_spec
'(' file_NAME_list
')'
541 lang_add_wild
(&$1, $3, ldgram_had_keep
);
546 input_section_spec_no_keep
548 { ldgram_had_keep
= TRUE
; }
549 input_section_spec_no_keep
')'
550 { ldgram_had_keep
= FALSE
; }
555 | CREATE_OBJECT_SYMBOLS
557 lang_add_attribute
(lang_object_symbols_statement_enum
);
563 lang_add_attribute
(lang_constructors_statement_enum
);
565 | SORT_BY_NAME
'(' CONSTRUCTORS
')'
567 constructors_sorted
= TRUE
;
568 lang_add_attribute
(lang_constructors_statement_enum
);
571 | length
'(' mustbe_exp
')'
573 lang_add_data
((int) $1, $3);
576 | FILL
'(' fill_exp
')'
580 | ASSERT_K
{ldlex_expression
();} '(' exp
',' NAME
')' end
582 lang_add_assignment
(exp_assert
($4, $6)); }
584 { ldlex_script
(); ldfile_open_command_file
($2); }
585 statement_list_opt END
586 { ldlex_popstate
(); }
590 statement_list statement
615 $$
= exp_get_fill
($1, 0, "fill value");
622 |
{ $$
= (fill_type
*) 0; }
652 lang_add_assignment
(exp_assop
($2, $1, $3));
654 | NAME assign_op mustbe_exp
656 lang_add_assignment
(exp_assop
('=', $1,
662 | PROVIDE
'(' NAME
'=' mustbe_exp
')'
664 lang_add_assignment
(exp_provide
($3, $5, FALSE
));
666 | PROVIDE_HIDDEN
'(' NAME
'=' mustbe_exp
')'
668 lang_add_assignment
(exp_provide
($3, $5, TRUE
));
678 MEMORY
'{' memory_spec_list_opt
'}'
681 memory_spec_list_opt: memory_spec_list |
;
684 memory_spec_list opt_comma memory_spec
690 { region
= lang_memory_region_lookup
($1, TRUE
); }
692 origin_spec opt_comma length_spec
695 { ldlex_script
(); ldfile_open_command_file
($2); }
696 memory_spec_list_opt END
697 { ldlex_popstate
(); }
701 ORIGIN
'=' mustbe_exp
703 region
->origin
= exp_get_vma
($3, 0, "origin");
704 region
->current
= region
->origin
;
709 LENGTH
'=' mustbe_exp
711 region
->length
= exp_get_vma
($3, -1, "length");
717 { /* dummy action to avoid bison 1.25 error message */ }
718 |
'(' attributes_list
')'
723 | attributes_list attributes_string
728 { lang_set_flags
(region
, $1, 0); }
730 { lang_set_flags
(region
, $2, 1); }
734 STARTUP
'(' filename
')'
735 { lang_startup
($3); }
739 HLL
'(' high_level_library_NAME_list
')'
741 { ldemul_hll
((char *)NULL
); }
744 high_level_library_NAME_list:
745 high_level_library_NAME_list opt_comma filename
753 SYSLIB
'(' low_level_library_NAME_list
')'
754 ; low_level_library_NAME_list
:
755 low_level_library_NAME_list opt_comma filename
756 { ldemul_syslib
($3); }
760 floating_point_support:
762 { lang_float
(TRUE
); }
764 { lang_float
(FALSE
); }
772 | NAME nocrossref_list
774 struct lang_nocrossref
*n
;
776 n
= (struct lang_nocrossref
*) xmalloc
(sizeof
*n
);
781 | NAME
',' nocrossref_list
783 struct lang_nocrossref
*n
;
785 n
= (struct lang_nocrossref
*) xmalloc
(sizeof
*n
);
792 mustbe_exp: { ldlex_expression
(); }
794 { ldlex_popstate
(); $$
=$2;}
799 { $$
= exp_unop
('-', $2); }
802 | NEXT
'(' exp
')' %prec UNARY
803 { $$
= exp_unop
((int) $1,$3); }
804 |
'!' exp %prec UNARY
805 { $$
= exp_unop
('!', $2); }
806 |
'+' exp %prec UNARY
808 |
'~' exp %prec UNARY
809 { $$
= exp_unop
('~', $2);}
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); }
822 { $$
= exp_binop
(LSHIFT
, $1, $3); }
824 { $$
= exp_binop
(RSHIFT
, $1, $3); }
826 { $$
= exp_binop
(EQ
, $1, $3); }
828 { $$
= exp_binop
(NE
, $1, $3); }
830 { $$
= exp_binop
(LE
, $1, $3); }
832 { $$
= exp_binop
(GE
, $1, $3); }
834 { $$
= exp_binop
('<' , $1, $3); }
836 { $$
= exp_binop
('>' , $1, $3); }
838 { $$
= exp_binop
('&' , $1, $3); }
840 { $$
= exp_binop
('^' , $1, $3); }
842 { $$
= exp_binop
('|' , $1, $3); }
843 | exp
'?' exp
':' exp
844 { $$
= exp_trinop
('?' , $1, $3, $5); }
846 { $$
= exp_binop
(ANDAND
, $1, $3); }
848 { $$
= exp_binop
(OROR
, $1, $3); }
849 | DEFINED
'(' NAME
')'
850 { $$
= exp_nameop
(DEFINED
, $3); }
852 { $$
= exp_bigintop
($1.integer
, $1.str
); }
854 { $$
= exp_nameop
(SIZEOF_HEADERS
,0); }
856 | ALIGNOF
'(' NAME
')'
857 { $$
= exp_nameop
(ALIGNOF
,$3); }
858 | SIZEOF
'(' NAME
')'
859 { $$
= exp_nameop
(SIZEOF
,$3); }
861 { $$
= exp_nameop
(ADDR
,$3); }
862 | LOADADDR
'(' NAME
')'
863 { $$
= exp_nameop
(LOADADDR
,$3); }
864 | CONSTANT
'(' NAME
')'
865 { $$
= exp_nameop
(CONSTANT
,$3); }
866 | ABSOLUTE
'(' exp
')'
867 { $$
= exp_unop
(ABSOLUTE
, $3); }
868 | ALIGN_K
'(' exp
')'
869 { $$
= exp_unop
(ALIGN_K
,$3); }
870 | ALIGN_K
'(' exp
',' exp
')'
871 { $$
= exp_binop
(ALIGN_K
,$3,$5); }
872 | DATA_SEGMENT_ALIGN
'(' exp
',' exp
')'
873 { $$
= exp_binop
(DATA_SEGMENT_ALIGN
, $3, $5); }
874 | DATA_SEGMENT_RELRO_END
'(' exp
',' exp
')'
875 { $$
= exp_binop
(DATA_SEGMENT_RELRO_END
, $5, $3); }
876 | DATA_SEGMENT_END
'(' exp
')'
877 { $$
= exp_unop
(DATA_SEGMENT_END
, $3); }
878 | SEGMENT_START
'(' NAME
',' exp
')'
879 { /* The operands to the expression node are
880 placed in the opposite order from the way
881 in which they appear in the script as
882 that allows us to reuse more code in
884 $$
= exp_binop
(SEGMENT_START
,
886 exp_nameop
(NAME
, $3)); }
888 { $$
= exp_unop
(ALIGN_K
,$3); }
890 { $$
= exp_nameop
(NAME
,$1); }
891 | MAX_K
'(' exp
',' exp
')'
892 { $$
= exp_binop
(MAX_K
, $3, $5 ); }
893 | MIN_K
'(' exp
',' exp
')'
894 { $$
= exp_binop
(MIN_K
, $3, $5 ); }
895 | ASSERT_K
'(' exp
',' NAME
')'
896 { $$
= exp_assert
($3, $5); }
897 | ORIGIN
'(' NAME
')'
898 { $$
= exp_nameop
(ORIGIN
, $3); }
899 | LENGTH
'(' NAME
')'
900 { $$
= exp_nameop
(LENGTH
, $3); }
905 AT
'>' NAME
{ $$
= $3; }
910 AT
'(' exp
')' { $$
= $3; }
915 ALIGN_K
'(' exp
')' { $$
= $3; }
920 SUBALIGN
'(' exp
')' { $$
= $3; }
925 ONLY_IF_RO
{ $$
= ONLY_IF_RO
; }
926 | ONLY_IF_RW
{ $$
= ONLY_IF_RW
; }
927 | SPECIAL
{ $$
= SPECIAL
; }
931 section: NAME
{ ldlex_expression
(); }
935 opt_subalign
{ ldlex_popstate
(); ldlex_script
(); }
939 lang_enter_output_section_statement
($1, $3,
944 '}' { ldlex_popstate
(); ldlex_expression
(); }
945 memspec_opt memspec_at_opt phdr_opt fill_opt
948 lang_leave_output_section_statement
($17, $14, $16, $15);
953 { ldlex_expression
(); }
954 opt_exp_without_type opt_nocrossrefs opt_at opt_subalign
955 { ldlex_popstate
(); ldlex_script
(); }
958 lang_enter_overlay
($3, $6);
962 { ldlex_popstate
(); ldlex_expression
(); }
963 memspec_opt memspec_at_opt phdr_opt fill_opt
966 lang_leave_overlay
($5, (int) $4,
970 |
/* The GROUP case is just enough to support the gcc
971 svr3.ifile script. It is not intended to be full
972 support. I'm not even sure what GROUP is supposed
974 GROUP
{ ldlex_expression
(); }
978 lang_add_assignment
(exp_assop
('=', ".", $3));
980 '{' sec_or_group_p1
'}'
982 { ldlex_script
(); ldfile_open_command_file
($2); }
984 { ldlex_popstate
(); }
988 NOLOAD
{ sectype
= noload_section
; }
989 | DSECT
{ sectype
= noalloc_section
; }
990 | COPY
{ sectype
= noalloc_section
; }
991 | INFO
{ sectype
= noalloc_section
; }
992 | OVERLAY
{ sectype
= noalloc_section
; }
997 |
/* EMPTY */ { sectype
= normal_section
; }
998 |
'(' ')' { sectype
= normal_section
; }
1002 exp atype
':' { $$
= $1; }
1003 | atype
':' { $$
= (etree_type
*)NULL
; }
1004 |
/* The BIND cases are to support the gcc svr3.ifile
1005 script. They aren't intended to implement full
1006 support for the BIND keyword. I'm not even sure
1007 what BIND is supposed to mean. */
1008 BIND
'(' exp
')' atype
':' { $$
= $3; }
1009 | BIND
'(' exp
')' BLOCK
'(' exp
')' atype
':'
1013 opt_exp_without_type:
1014 exp
':' { $$
= $1; }
1015 |
':' { $$
= (etree_type
*) NULL
; }
1028 |
{ $$
= DEFAULT_MEMORY_REGION
; }
1038 struct lang_output_section_phdr_list
*n
;
1040 n
= ((struct lang_output_section_phdr_list
*)
1041 xmalloc
(sizeof
*n
));
1055 lang_enter_overlay_section
($2);
1057 '{' statement_list_opt
'}'
1058 { ldlex_popstate
(); ldlex_expression
(); }
1062 lang_leave_overlay_section
($9, $8);
1068 PHDRS
'{' phdr_list
'}'
1077 NAME
{ ldlex_expression
(); }
1078 phdr_type phdr_qualifiers
{ ldlex_popstate
(); }
1081 lang_new_phdr
($1, $3, $4.filehdr
, $4.phdrs
, $4.at
,
1091 if
($1->type.node_class
== etree_name
1092 && $1->type.node_code
== NAME
)
1096 static const char * const phdr_types
[] =
1098 "PT_NULL", "PT_LOAD", "PT_DYNAMIC",
1099 "PT_INTERP", "PT_NOTE", "PT_SHLIB",
1105 i
< sizeof phdr_types
/ sizeof phdr_types
[0];
1107 if
(strcmp
(s
, phdr_types
[i
]) == 0)
1112 if
(i
== sizeof phdr_types
/ sizeof phdr_types
[0])
1114 if
(strcmp
(s
, "PT_GNU_EH_FRAME") == 0)
1115 $$
= exp_intop
(0x6474e550);
1116 else if
(strcmp
(s
, "PT_GNU_STACK") == 0)
1117 $$
= exp_intop
(0x6474e551);
1121 %X%P:%S: unknown phdr type `%s' (try integer literal)\n"),
1133 memset
(&$$
, 0, sizeof
(struct phdr_info
));
1135 | NAME phdr_val phdr_qualifiers
1138 if
(strcmp
($1, "FILEHDR") == 0 && $2 == NULL
)
1140 else if
(strcmp
($1, "PHDRS") == 0 && $2 == NULL
)
1142 else if
(strcmp
($1, "FLAGS") == 0 && $2 != NULL
)
1145 einfo
(_
("%X%P:%S: PHDRS syntax error at `%s'\n"), $1);
1147 | AT
'(' exp
')' phdr_qualifiers
1167 ldlex_version_file
();
1168 PUSH_ERROR
(_
("dynamic list"));
1179 | dynamic_list_nodes dynamic_list_node
1183 '{' dynamic_list_tag
'}' ';'
1189 lang_append_dynamic_list
($1);
1193 /* This syntax is used within an external version script file. */
1195 version_script_file:
1197 ldlex_version_file
();
1198 PUSH_ERROR
(_
("VERSION script"));
1207 /* This is used within a normal linker script file. */
1211 ldlex_version_script
();
1213 VERSIONK
'{' vers_nodes
'}'
1221 | vers_nodes vers_node
1225 '{' vers_tag
'}' ';'
1227 lang_register_vers_node
(NULL
, $2, NULL
);
1229 | VERS_TAG
'{' vers_tag
'}' ';'
1231 lang_register_vers_node
($1, $3, NULL
);
1233 | VERS_TAG
'{' vers_tag
'}' verdep
';'
1235 lang_register_vers_node
($1, $3, $5);
1242 $$
= lang_add_vers_depend
(NULL
, $1);
1246 $$
= lang_add_vers_depend
($1, $2);
1253 $$
= lang_new_vers_node
(NULL
, NULL
);
1257 $$
= lang_new_vers_node
($1, NULL
);
1259 | GLOBAL
':' vers_defns
';'
1261 $$
= lang_new_vers_node
($3, NULL
);
1263 | LOCAL
':' vers_defns
';'
1265 $$
= lang_new_vers_node
(NULL
, $3);
1267 | GLOBAL
':' vers_defns
';' LOCAL
':' vers_defns
';'
1269 $$
= lang_new_vers_node
($3, $7);
1276 $$
= lang_new_vers_pattern
(NULL
, $1, ldgram_vers_current_lang
, FALSE
);
1280 $$
= lang_new_vers_pattern
(NULL
, $1, ldgram_vers_current_lang
, TRUE
);
1282 | vers_defns
';' VERS_IDENTIFIER
1284 $$
= lang_new_vers_pattern
($1, $3, ldgram_vers_current_lang
, FALSE
);
1286 | vers_defns
';' NAME
1288 $$
= lang_new_vers_pattern
($1, $3, ldgram_vers_current_lang
, TRUE
);
1290 | vers_defns
';' EXTERN NAME
'{'
1292 $
<name
>$
= ldgram_vers_current_lang
;
1293 ldgram_vers_current_lang
= $4;
1295 vers_defns opt_semicolon
'}'
1297 struct bfd_elf_version_expr
*pat
;
1298 for
(pat
= $7; pat
->next
!= NULL
; pat
= pat
->next
);
1301 ldgram_vers_current_lang
= $
<name
>6;
1305 $
<name
>$
= ldgram_vers_current_lang
;
1306 ldgram_vers_current_lang
= $2;
1308 vers_defns opt_semicolon
'}'
1311 ldgram_vers_current_lang
= $
<name
>4;
1315 $$
= lang_new_vers_pattern
(NULL
, "global", ldgram_vers_current_lang
, FALSE
);
1317 | vers_defns
';' GLOBAL
1319 $$
= lang_new_vers_pattern
($1, "global", ldgram_vers_current_lang
, FALSE
);
1323 $$
= lang_new_vers_pattern
(NULL
, "local", ldgram_vers_current_lang
, FALSE
);
1325 | vers_defns
';' LOCAL
1327 $$
= lang_new_vers_pattern
($1, "local", ldgram_vers_current_lang
, FALSE
);
1331 $$
= lang_new_vers_pattern
(NULL
, "extern", ldgram_vers_current_lang
, FALSE
);
1333 | vers_defns
';' EXTERN
1335 $$
= lang_new_vers_pattern
($1, "extern", ldgram_vers_current_lang
, FALSE
);
1349 if
(ldfile_assumed_script
)
1350 einfo
(_
("%P:%s: file format not recognized; treating as linker script\n"),
1351 ldfile_input_filename
);
1352 if
(error_index
> 0 && error_index
< ERROR_NAME_MAX
)
1353 einfo
("%P%F:%S: %s in %s\n", arg
, error_names
[error_index
-1]);
1355 einfo
("%P%F:%S: %s\n", arg
);