X-Git-Url: https://oss.titaniummirror.com/gitweb?p=msp430-binutils.git;a=blobdiff_plain;f=ld%2Fldgram.y;fp=ld%2Fldgram.y;h=aa639a1f737c08c7a5f8fb2ebb829338830b665b;hp=5b68b6be5637ca7587e5d89deb8b59abe43ca82d;hb=d5da4f291af551c0b8b79e1d4a9b173d60e5c10e;hpb=7b5ea4fcdf2819e070665ab5610f8b48e3867c10 diff --git a/ld/ldgram.y b/ld/ldgram.y index 5b68b6b..aa639a1 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -1,6 +1,7 @@ /* 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. @@ -49,11 +50,6 @@ static enum section_type sectype; static lang_memory_region_type *region; -FILE *saved_script_handle = NULL; -bfd_boolean force_make_executable = FALSE; - -bfd_boolean ldgram_in_script = FALSE; -bfd_boolean ldgram_had_equals = FALSE; bfd_boolean ldgram_had_keep = FALSE; char *ldgram_vers_current_lang = NULL; @@ -127,7 +123,8 @@ static int error_index; %token END %left '(' %token ALIGN_K BLOCK BIND QUAD SQUAD LONG SHORT BYTE -%token SECTIONS PHDRS DATA_SEGMENT_ALIGN DATA_SEGMENT_RELRO_END DATA_SEGMENT_END +%token SECTIONS PHDRS INSERT_K AFTER BEFORE +%token DATA_SEGMENT_ALIGN DATA_SEGMENT_RELRO_END DATA_SEGMENT_END %token SORT_BY_NAME SORT_BY_ALIGNMENT %token '{' '}' %token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH @@ -135,6 +132,7 @@ static int error_index; %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 NEXT @@ -352,6 +350,12 @@ ifile_p1: lang_add_nocrossref ($3); } | EXTERN '(' extern_name_list ')' + | INSERT_K AFTER NAME + { 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: @@ -577,6 +581,10 @@ statement: | 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: @@ -668,13 +676,14 @@ opt_comma: 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 ; @@ -683,6 +692,10 @@ memory_spec: NAME 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: @@ -966,6 +979,10 @@ section: NAME { ldlex_expression(); } 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: