/* A YACC grammer to parse a superset of the AT&T linker scripting languaue.
- Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
#include "ldexp.h"
#include "ldver.h"
#include "ldlang.h"
-#include "ldemul.h"
#include "ldfile.h"
+#include "ldemul.h"
#include "ldmisc.h"
#include "ldmain.h"
#include "mri.h"
char *name;
const char *cname;
struct wildcard_spec wildcard;
+ struct name_list *name_list;
int token;
union etree_union *etree;
struct phdr_info
%type <etree> exp opt_exp_with_type mustbe_exp opt_at phdr_type phdr_val
%type <etree> opt_exp_without_type
%type <integer> fill_opt
+%type <name_list> exclude_name_list
%type <name> memspec_opt casesymlist
+%type <name> memspec_at_opt
%type <cname> wildcard_name
%type <wildcard> wildcard_spec
%token <integer> INT
{
$$.name = $1;
$$.sorted = false;
- $$.exclude_name = NULL;
+ $$.exclude_name_list = NULL;
}
- | EXCLUDE_FILE '(' wildcard_name ')' wildcard_name
+ | EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name
{
$$.name = $5;
$$.sorted = false;
- $$.exclude_name = $3;
+ $$.exclude_name_list = $3;
}
| SORT '(' wildcard_name ')'
{
$$.name = $3;
$$.sorted = true;
- $$.exclude_name = NULL;
+ $$.exclude_name_list = NULL;
}
- | SORT '(' EXCLUDE_FILE '(' wildcard_name ')' wildcard_name ')'
+ | SORT '(' EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name ')'
{
$$.name = $7;
$$.sorted = true;
- $$.exclude_name = $5;
+ $$.exclude_name_list = $5;
}
;
+
+exclude_name_list:
+ exclude_name_list wildcard_name
+ {
+ struct name_list *tmp;
+ tmp = (struct name_list *) xmalloc (sizeof *tmp);
+ tmp->name = $2;
+ tmp->next = $1;
+ $$ = tmp;
+ }
+ |
+ wildcard_name
+ {
+ struct name_list *tmp;
+ tmp = (struct name_list *) xmalloc (sizeof *tmp);
+ tmp->name = $1;
+ tmp->next = NULL;
+ $$ = tmp;
+ }
+ ;
+
file_NAME_list:
wildcard_spec
{
lang_add_wild ($1.name, $1.sorted,
current_file.name,
current_file.sorted,
- ldgram_had_keep, $1.exclude_name);
+ ldgram_had_keep, $1.exclude_name_list);
}
| file_NAME_list opt_comma wildcard_spec
{
lang_add_wild ($3.name, $3.sorted,
current_file.name,
current_file.sorted,
- ldgram_had_keep, $3.exclude_name);
+ ldgram_had_keep, $3.exclude_name_list);
}
;
attributes_opt ':'
origin_spec opt_comma length_spec
- ; origin_spec:
+ ;
+
+origin_spec:
ORIGIN '=' mustbe_exp
{ region->current =
region->origin =
;
+memspec_at_opt:
+ AT '>' NAME { $$ = $3; }
+ | { $$ = "*default*"; }
+ ;
+
opt_at:
AT '(' exp ')' { $$ = $3; }
| { $$ = 0; }
}
statement_list_opt
'}' { ldlex_popstate (); ldlex_expression (); }
- memspec_opt phdr_opt fill_opt
+ memspec_opt memspec_at_opt phdr_opt fill_opt
{
ldlex_popstate ();
- lang_leave_output_section_statement ($13, $11, $12);
+ lang_leave_output_section_statement ($14, $11, $13, $12);
}
opt_comma
| OVERLAY
overlay_section
'}'
{ ldlex_popstate (); ldlex_expression (); }
- memspec_opt phdr_opt fill_opt
+ memspec_opt memspec_at_opt phdr_opt fill_opt
{
ldlex_popstate ();
- lang_leave_overlay ($14, $12, $13);
+ lang_leave_overlay ($15, $12, $14, $13);
}
opt_comma
| /* The GROUP case is just enough to support the gcc
}
vers_defns '}'
{
+ $$ = $5;
ldgram_vers_current_lang = $<name>4;
}
;