2000-02-27 Mark Elbrecht <snowball3@bigfoot.com>
[deliverable/binutils-gdb.git] / ld / deffilep.y
index aacde6b989edab2297ebd108658eb6b26526b1f5..760167b4ce549e8a40a66020717f46bc5e63b090 100644 (file)
@@ -1,6 +1,6 @@
 %{ /* deffilep.y - parser for .def files */
 
-/*   Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
+/*   Copyright (C) 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
 
@@ -93,7 +93,6 @@ static void def_version PARAMS ((int, int));
 static void def_directive PARAMS ((char *));
 static int def_parse PARAMS ((void));
 static int def_error PARAMS ((const char *));
-static int def_debug;
 static int def_lex PARAMS ((void));
 
 static int lex_forced_token = 0;
@@ -107,9 +106,10 @@ static const char *lex_parse_string_end = 0;
   int number;
 };
 
-%token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATA
-%token SECTIONS, EXPORTS, IMPORTS, VERSIONK, BASE, CONSTANT, PRIVATE
-%token READ WRITE EXECUTE SHARED NONAME DIRECTIVE
+%token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATAU, DATAL
+%token SECTIONS, EXPORTS, IMPORTS, VERSIONK, BASE, CONSTANTU, CONSTANTL
+%token PRIVATEU, PRIVATEL
+%token READ WRITE EXECUTE SHARED NONAMEU NONAMEL DIRECTIVE
 %token <id> ID
 %token <number> NUMBER
 %type  <number> opt_base opt_ordinal
@@ -129,7 +129,7 @@ command:
        |       STACKSIZE NUMBER opt_number { def_stacksize ($2, $3);}
        |       HEAPSIZE NUMBER opt_number { def_heapsize ($2, $3);}
        |       CODE attr_list { def_section ("CODE", $2);}
-       |       DATA attr_list  { def_section ("DATA", $2);}
+       |       DATAU attr_list  { def_section ("DATA", $2);}
        |       SECTIONS seclist
        |       EXPORTS explist 
        |       IMPORTS implist
@@ -146,18 +146,28 @@ explist:
        ;
 
 expline:
-               ID opt_equal_name opt_ordinal exp_opt_list
-                       { def_exports ($1, $2, $3, $4); }
+               /* The opt_comma is necessary to support both the usual
+                 DEF file syntax as well as .drectve syntax which
+                 mandates <expsym>,<expoptlist>.  */
+               ID opt_equal_name opt_ordinal opt_comma exp_opt_list
+                       { def_exports ($1, $2, $3, $5); }
        ;
 exp_opt_list:
-               exp_opt exp_opt_list { $$ = $1 | $2; }
+               /* The opt_comma is necessary to support both the usual
+                  DEF file syntax as well as .drectve syntax which
+                  allows for comma separated opt list.  */
+               exp_opt opt_comma exp_opt_list { $$ = $1 | $3; }
        |       { $$ = 0; }
        ;
 exp_opt:
-               NONAME          { $$ = 1; }
-       |       CONSTANT        { $$ = 2; }
-       |       DATA            { $$ = 4; }
-       |       PRIVATE         { $$ = 8; }
+               NONAMEU         { $$ = 1; }
+       |       NONAMEL         { $$ = 1; }
+       |       CONSTANTU       { $$ = 2; }
+       |       CONSTANTL       { $$ = 2; }
+       |       DATAU           { $$ = 4; }
+       |       DATAL           { $$ = 4; }
+       |       PRIVATEU        { $$ = 8; }
+       |       PRIVATEL        { $$ = 8; }
        ;
 implist:       
                implist impline
@@ -204,7 +214,13 @@ attr:
        ;
 
 opt_name: ID           { $$ = $1; }
-       |               { $$ = 0; }
+       | ID '.' ID     
+         { 
+           char * name = xmalloc (strlen ($1) + 1 + strlen ($3) + 1);
+           sprintf (name, "%s.%s", $1, $3);
+           $$ = name;
+         }
+       |               { $$ = ""; }
        ;
 
 opt_ordinal: 
@@ -828,8 +844,10 @@ tokens[] =
 {
   { "BASE", BASE },
   { "CODE", CODE },
-  { "CONSTANT", CONSTANT },
-  { "DATA", DATA },
+  { "CONSTANT", CONSTANTU },
+  { "constant", CONSTANTL },
+  { "DATA", DATAU },
+  { "data", DATAL },
   { "DESCRIPTION", DESCRIPTION },
   { "DIRECTIVE", DIRECTIVE },
   { "EXECUTE", EXECUTE },
@@ -838,8 +856,10 @@ tokens[] =
   { "IMPORTS", IMPORTS },
   { "LIBRARY", LIBRARY },
   { "NAME", NAME },
-  { "NONAME", NONAME },
-  { "PRIVATE", PRIVATE },
+  { "NONAME", NONAMEU },
+  { "noname", NONAMEL },
+  { "PRIVATE", PRIVATEU },
+  { "private", PRIVATEL },
   { "READ", READ },
   { "SECTIONS", SECTIONS },
   { "SEGMENTS", SECTIONS },
This page took 0.025981 seconds and 4 git commands to generate.