summaryrefslogtreecommitdiff
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
commita0b484d35f3c5d3b7f74b2e3b1ed471440c1382b (patch)
tree9e84595f968f28ce7d2013fc5f045b3e172669a6 /ld/ldgram.y
parent1f91b82462f5862997f352c94cfffec13cc8ee6d (diff)
downloadbinutils-redhat-a0b484d35f3c5d3b7f74b2e3b1ed471440c1382b.tar.gz
* 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 f481f54c7d..1149e6b29c 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: