* libtool.m4 (_LT_ENABLE_LOCK <ld -m flags>): Remove non-canonical
[deliverable/binutils-gdb.git] / ld / deffilep.y
index 3afb3ce3ce859ffcd370f53c99afbeadb3136c2e..2dd21be8bb6582dc48dd607422c7110d3c6eacf0 100644 (file)
 #define        yylval  def_lval
 #define        yychar  def_char
 #define        yydebug def_debug
-#define        yypact  def_pact        
-#define        yyr1    def_r1                  
-#define        yyr2    def_r2                  
-#define        yydef   def_def         
-#define        yychk   def_chk         
-#define        yypgo   def_pgo         
-#define        yyact   def_act         
+#define        yypact  def_pact
+#define        yyr1    def_r1
+#define        yyr2    def_r2
+#define        yydef   def_def
+#define        yychk   def_chk
+#define        yypgo   def_pgo
+#define        yyact   def_act
 #define        yyexca  def_exca
 #define yyerrflag def_errflag
 #define yynerrs        def_nerrs
@@ -94,7 +94,7 @@ static void def_exports (const char *, const char *, int, int, const char *);
 static void def_heapsize (int, int);
 static void def_import (const char *, const char *, const char *, const char *,
                        int, const char *);
-static void def_image_name (const char *, int, int);
+static void def_image_name (const char *, bfd_vma, int);
 static void def_section (const char *, int);
 static void def_section_alt (const char *, const char *);
 static void def_stacksize (int, int);
@@ -115,6 +115,7 @@ static const char *lex_parse_string_end = 0;
   char *id;
   const char *id_const;
   int number;
+  bfd_vma vma;
   char *digits;
 };
 
@@ -125,8 +126,9 @@ static const char *lex_parse_string_end = 0;
 %token <id> ID
 %token <digits> DIGITS
 %type  <number> NUMBER
+%type  <vma> VMA opt_base
 %type  <digits> opt_digits
-%type  <number> opt_base opt_ordinal
+%type  <number> opt_ordinal
 %type  <number> attr attr_list opt_number exp_opt_list exp_opt
 %type  <id> opt_name opt_name2 opt_equal_name anylang_id opt_id
 %type  <id> opt_equalequal_name
@@ -138,7 +140,7 @@ start: start command
        | command
        ;
 
-command: 
+command:
                NAME opt_name opt_base { def_image_name ($2, $3, 0); }
        |       LIBRARY opt_name opt_base { def_image_name ($2, $3, 1); }
        |       DESCRIPTION ID { def_description ($2);}
@@ -147,7 +149,7 @@ command:
        |       CODE attr_list { def_section ("CODE", $2);}
        |       DATAU attr_list  { def_section ("DATA", $2);}
        |       SECTIONS seclist
-       |       EXPORTS explist 
+       |       EXPORTS explist
        |       IMPORTS implist
        |       VERSIONK NUMBER { def_version ($2, 0);}
        |       VERSIONK NUMBER '.' NUMBER { def_version ($2, $4);}
@@ -186,7 +188,7 @@ exp_opt:
        |       PRIVATEU        { $$ = 8; }
        |       PRIVATEL        { $$ = 8; }
        ;
-implist:       
+implist:
                implist impline
        |       impline
        ;
@@ -223,15 +225,15 @@ attr_list:
 
 opt_comma:
        ','
-       | 
+       |
        ;
 opt_number: ',' NUMBER { $$=$2;}
        |          { $$=-1;}
        ;
-       
+
 attr:
                READ    { $$ = 1;}
-       |       WRITE   { $$ = 2;}      
+       |       WRITE   { $$ = 2;}
        |       EXECUTE { $$=4;}
        |       SHARED  { $$=8;}
        ;
@@ -275,19 +277,19 @@ opt_name2: ID { $$ = $1; }
            $$ = name;
          }
        | '.' opt_name2
-         { 
+         {
            char *name = def_pool_alloc (strlen ($2) + 2);
            sprintf (name, ".%s", $2);
            $$ = name;
          }
        | keyword_as_name '.' opt_name2
-         { 
+         {
            char *name = def_pool_alloc (strlen ($1) + 1 + strlen ($3) + 1);
            sprintf (name, "%s.%s", $1, $3);
            $$ = name;
          }
        | ID '.' opt_name2
-         { 
+         {
            char *name = def_pool_alloc (strlen ($1) + 1 + strlen ($3) + 1);
            sprintf (name, "%s.%s", $1, $3);
            $$ = name;
@@ -302,18 +304,18 @@ opt_equalequal_name: EQUAL ID     { $$ = $2; }
        |                                                       { $$ = 0; }
        ;
 
-opt_ordinal: 
+opt_ordinal:
          '@' NUMBER     { $$ = $2;}
        |                { $$ = -1;}
        ;
 
 opt_equal_name:
           '=' opt_name2        { $$ = $2; }
-        |              { $$ =  0; }                     
+        |              { $$ =  0; }
        ;
 
-opt_base: BASE '=' NUMBER      { $$ = $3;}
-       |       { $$ = -1;}
+opt_base: BASE '=' VMA { $$ = $3;}
+       |       { $$ = (bfd_vma) -1;}
        ;
 
 anylang_id: ID         { $$ = $1; }
@@ -340,6 +342,8 @@ opt_id: ID          { $$ = $1; }
        ;
 
 NUMBER: DIGITS         { $$ = strtoul ($1, 0, 0); }
+       ;
+VMA: DIGITS            { $$ = (bfd_vma) strtoull ($1, 0, 0); }
 
 %%
 
@@ -509,7 +513,11 @@ def_file_print (FILE *file, def_file *fdef)
   if (fdef->is_dll != -1)
     fprintf (file, "  is dll: %s\n", fdef->is_dll ? "yes" : "no");
   if (fdef->base_address != (bfd_vma) -1)
-    fprintf (file, "  base address: 0x%08x\n", fdef->base_address);
+    {
+      fprintf (file, "  base address: 0x");
+      fprintf_vma (file, fdef->base_address);
+      fprintf (file, "\n");
+    }
   if (fdef->description)
     fprintf (file, "  description: `%s'\n", fdef->description);
   if (fdef->stack_reserve != -1)
@@ -926,13 +934,20 @@ def_file_add_directive (def_file *my_def, const char *param, int len)
 
       if (!diropts[i].param)
        {
-         char saved;
+         if (tend < pend)
+           {
+             char saved;
 
-         saved = * tend;
-         * tend = 0;
-         /* xgettext:c-format */
-         einfo (_("Warning: .drectve `%s' unrecognized\n"), param);
-         * tend = saved;
+             saved = * tend;
+             * tend = 0;
+             /* xgettext:c-format */
+             einfo (_("Warning: .drectve `%s' unrecognized\n"), param);
+             * tend = saved;
+           }
+         else
+           {
+             einfo (_("Warning: corrupt .drectve at end of def file\n"));
+           }
        }
 
       lex_parse_string = 0;
@@ -946,7 +961,7 @@ def_file_add_directive (def_file *my_def, const char *param, int len)
 /* Parser Callbacks.  */
 
 static void
-def_image_name (const char *name, int base, int is_dll)
+def_image_name (const char *name, bfd_vma base, int is_dll)
 {
   /* If a LIBRARY or NAME statement is specified without a name, there is nothing
      to do here.  We retain the output filename specified on command line.  */
@@ -960,7 +975,7 @@ def_image_name (const char *name, int base, int is_dll)
               name);
       if (def->name)
        free (def->name);
-      /* Append the default suffix, if none specified.  */ 
+      /* Append the default suffix, if none specified.  */
       if (strchr (image_name, '.') == 0)
        {
          const char * suffix = is_dll ? ".dll" : ".exe";
@@ -1115,7 +1130,7 @@ def_import (const char *internal_name,
   char *buf = 0;
   const char *ext = dllext ? dllext : "dll";
   int is_dup = 0;
-   
+
   buf = xmalloc (strlen (module) + strlen (ext) + 2);
   sprintf (buf, "%s.%s", module, ext);
   module = buf;
@@ -1147,7 +1162,7 @@ static void
 def_aligncomm (char *str, int align)
 {
   def_file_aligncomm *c, *p;
-  
+
   p = NULL;
   c = def->aligncomms;
   while (c != NULL)
This page took 0.029166 seconds and 4 git commands to generate.