aboutsummaryrefslogtreecommitdiff
path: root/ld/ldgram.y
diff options
context:
space:
mode:
Diffstat (limited to 'ld/ldgram.y')
-rw-r--r--ld/ldgram.y49
1 files changed, 27 insertions, 22 deletions
diff --git a/ld/ldgram.y b/ld/ldgram.y
index 2df9756..655a726 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -1,6 +1,6 @@
/* 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 Free Software Foundation, Inc.
+ 2001, 2002 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
This file is part of GNU ld.
@@ -66,6 +66,12 @@ static int error_index;
%}
%union {
bfd_vma integer;
+ struct big_int
+ {
+ bfd_vma integer;
+ char *str;
+ } bigint;
+ fill_type *fill;
char *name;
const char *cname;
struct wildcard_spec wildcard;
@@ -89,14 +95,14 @@ static int error_index;
%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 <fill> fill_opt fill_exp
%type <name_list> exclude_name_list
%type <wildcard_list> file_NAME_list
%type <name> memspec_opt casesymlist
%type <name> memspec_at_opt
%type <cname> wildcard_name
%type <wildcard> wildcard_spec
-%token <integer> INT
+%token <bigint> INT
%token <name> NAME LNAME
%type <integer> length
%type <phdr> phdr_qualifiers
@@ -230,11 +236,11 @@ mri_script_command:
| ALIAS NAME ',' NAME
{ mri_alias($2,$4,0);}
| ALIAS NAME ',' INT
- { mri_alias($2,0,(int) $4);}
+ { mri_alias ($2, 0, (int) $4.integer); }
| BASE exp
{ mri_base($2); }
- | TRUNCATE INT
- { mri_truncate((unsigned int) $2); }
+ | TRUNCATE INT
+ { mri_truncate ((unsigned int) $2.integer); }
| CASE casesymlist
| EXTERN extern_name_list
| INCLUDE filename
@@ -512,16 +518,12 @@ statement:
| input_section_spec
| length '(' mustbe_exp ')'
{
- lang_add_data((int) $1,$3);
+ lang_add_data ((int) $1, $3);
}
- | FILL '(' mustbe_exp ')'
+ | FILL '(' fill_exp ')'
{
- lang_add_fill
- (exp_get_value_int($3,
- 0,
- "fill value",
- lang_first_phase_enum));
+ lang_add_fill ($3);
}
;
@@ -548,18 +550,21 @@ length:
{ $$ = $1; }
;
-fill_opt:
- '=' mustbe_exp
+fill_exp:
+ mustbe_exp
{
- $$ = exp_get_value_int($2,
- 0,
- "fill value",
- lang_first_phase_enum);
+ $$ = exp_get_fill ($1,
+ 0,
+ "fill value",
+ lang_first_phase_enum);
}
- | { $$ = 0; }
;
-
+fill_opt:
+ '=' fill_exp
+ { $$ = $2; }
+ | { $$ = (fill_type *) 0; }
+ ;
assign_op:
PLUSEQ
@@ -781,7 +786,7 @@ exp :
| DEFINED '(' NAME ')'
{ $$ = exp_nameop(DEFINED, $3); }
| INT
- { $$ = exp_intop($1); }
+ { $$ = exp_bigintop ($1.integer, $1.str); }
| SIZEOF_HEADERS
{ $$ = exp_nameop(SIZEOF_HEADERS,0); }