/* A YACC grammar to parse a superset of the AT&T linker scripting language.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
This file is part of the GNU Binutils.
%token SEGMENT_START
%token INCLUDE
%token MEMORY
+%token REGION_ALIAS
%token NOLOAD DSECT COPY INFO OVERLAY
%token DEFINED TARGET_K SEARCH_DIR MAP ENTRY
%token <integer> NEXT
{ lang_add_insert ($3, 0); }
| INSERT_K BEFORE NAME
{ lang_add_insert ($3, 1); }
+ | REGION_ALIAS '(' NAME ',' NAME ')'
+ { lang_memory_region_alias ($3, $5); }
;
input_list:
{ lang_add_input_file($2,lang_input_file_is_l_enum,
(char *)NULL); }
| AS_NEEDED '('
- { $<integer>$ = as_needed; as_needed = TRUE; }
+ { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
input_list ')'
- { as_needed = $<integer>3; }
+ { add_DT_NEEDED_for_regular = $<integer>3; }
| input_list ',' AS_NEEDED '('
- { $<integer>$ = as_needed; as_needed = TRUE; }
+ { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
input_list ')'
- { as_needed = $<integer>5; }
+ { add_DT_NEEDED_for_regular = $<integer>5; }
| input_list AS_NEEDED '('
- { $<integer>$ = as_needed; as_needed = TRUE; }
+ { $<integer>$ = add_DT_NEEDED_for_regular; add_DT_NEEDED_for_regular = TRUE; }
input_list ')'
- { as_needed = $<integer>4; }
+ { add_DT_NEEDED_for_regular = $<integer>4; }
;
sections:
| ASSERT_K {ldlex_expression ();} '(' exp ',' NAME ')' end
{ ldlex_popstate ();
lang_add_assignment (exp_assert ($4, $6)); }
+ | INCLUDE filename
+ { ldlex_script (); ldfile_open_command_file($2); }
+ statement_list_opt END
+ { ldlex_popstate (); }
;
statement_list:
memory:
- MEMORY '{' memory_spec memory_spec_list '}'
+ MEMORY '{' memory_spec_list_opt '}'
;
+memory_spec_list_opt: memory_spec_list | ;
+
memory_spec_list:
- memory_spec_list memory_spec
- | memory_spec_list ',' memory_spec
- |
+ memory_spec_list opt_comma memory_spec
+ | memory_spec
;
attributes_opt ':'
origin_spec opt_comma length_spec
{}
+ | INCLUDE filename
+ { ldlex_script (); ldfile_open_command_file($2); }
+ memory_spec_list_opt END
+ { ldlex_popstate (); }
;
origin_spec:
lang_add_assignment (exp_assop ('=', ".", $3));
}
'{' sec_or_group_p1 '}'
+ | INCLUDE filename
+ { ldlex_script (); ldfile_open_command_file($2); }
+ sec_or_group_p1 END
+ { ldlex_popstate (); }
;
type: