aboutsummaryrefslogtreecommitdiff
path: root/ld/ldgram.y
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2008-07-06 13:38:37 +0000
committerNathan Sidwell <nathan@codesourcery.com>2008-07-06 13:38:37 +0000
commit4006703d71641cd35a045f407a5c8bc85459978b (patch)
treeefdd737568b7398b5dfbebf04eb1538c3144266a /ld/ldgram.y
parentb56e7235bb83ed5cf86c71db7c9009fd4491bd0d (diff)
downloadgdb-4006703d71641cd35a045f407a5c8bc85459978b.zip
gdb-4006703d71641cd35a045f407a5c8bc85459978b.tar.gz
gdb-4006703d71641cd35a045f407a5c8bc85459978b.tar.bz2
* ld.texinfo (File Commands): Document that INCLUDE can be used in
several different places. * ldgram.y (statement, memory_spec, section): Allow INCLUDE. (memory, memory_spec_list): Simplify BNF (memory_spec_list_opt): New rule. * ldlex.l (INCLUDE): Recognize in EXPRESSION. testsuite/ * ld-scripts/include-1.d: New. * ld-scripts/include-1.t: New. * ld-scripts/include-data.t: New. * ld-scripts/include-mem.t: New. * ld-scripts/include-ram.t: New. * ld-scripts/include-sections.t: New. * ld-scripts/include-subdata.t: New. * ld-scripts/include.exp: New. * ld-scripts/include.s: New.
Diffstat (limited to 'ld/ldgram.y')
-rw-r--r--ld/ldgram.y21
1 files changed, 17 insertions, 4 deletions
diff --git a/ld/ldgram.y b/ld/ldgram.y
index f481f54..1149e6b 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -577,6 +577,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 +672,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 +688,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 +975,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: