]> Git Repo - binutils.git/blobdiff - ld/ldgram.y
* listing.c (list_symbol_table): Build a format string based on the size of the
[binutils.git] / ld / ldgram.y
index c4b83b3274daaeb8110b0f8f5303ced32897e49e..7d139719b6e176074137caf1649d97ee96a6ff99 100644 (file)
@@ -39,8 +39,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "mri.h"
 #include "ldlex.h"
 
-#define YYDEBUG 1
-
 static int typebits;
 
 lang_memory_region_type *region;
@@ -104,8 +102,8 @@ static int error_index;
 %token <integer> SIZEOF NEXT ADDR
 %token STARTUP HLL SYSLIB FLOAT NOFLOAT
 %token ORIGIN FILL
-%token LENGTH CREATE_OBJECT_SYMBOLS INPUT OUTPUT CONSTRUCTORS
-%token ALIGNMOD AT
+%token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS
+%token ALIGNMOD AT PROVIDE
 %type <token> assign_op 
 %type <name>  filename
 %token CHIP LIST SECT ABSOLUTE  LOAD NEWLINE ENDWORD ORDER NAMEWORD
@@ -155,7 +153,6 @@ mri_script_command:
                        einfo("%P%F: unrecognised keyword in MRI style script '%s'\n",$1);
                        }
        |       LIST    {
-                       write_map = true;
                        config.map_filename = "-";
                        }
         |       ORDER ordernamelist
@@ -242,7 +239,7 @@ ifile_p1:
        |       TARGET_K '(' NAME ')'
                { lang_add_target($3); }
        |       SEARCH_DIR '(' filename ')'
-               { ldfile_add_library_path($3); }
+               { ldfile_add_library_path ($3, false); }
        |       OUTPUT '(' filename ')'
                { lang_add_output($3, 1); }
         |      OUTPUT_FORMAT '(' NAME ')'
@@ -252,6 +249,10 @@ ifile_p1:
        |       FORCE_COMMON_ALLOCATION
                { command_line.force_common_definition = true ; }
        |       INPUT '(' input_list ')'
+       |       GROUP
+                 { lang_enter_group (); }
+                   '(' input_list ')'
+                 { lang_leave_group (); }
        |       MAP '(' filename ')'
                { lang_add_map($3); }
        |       INCLUDE filename 
@@ -282,7 +283,7 @@ sec_or_group_p1:
 
 statement_anywhere:
                ENTRY '(' NAME ')'
-               { lang_add_entry($3); }
+               { lang_add_entry ($3, 0); }
        |       assignment end
        ;
 
@@ -405,14 +406,20 @@ end:      ';' | ','
 assignment:
                NAME '=' mustbe_exp
                {
-                 lang_add_assignment(exp_assop($2,$1,$3));
+                 lang_add_assignment (exp_assop ($2, $1, $3));
                }
        |       NAME assign_op mustbe_exp
                {
-               
-lang_add_assignment(exp_assop('=',$1,exp_binop($2,exp_nameop(NAME,$1),$3)));
+                 lang_add_assignment (exp_assop ('=', $1,
+                                                 exp_binop ($2,
+                                                            exp_nameop (NAME,
+                                                                        $1),
+                                                            $3)));
+               }
+       |       PROVIDE '(' NAME '=' mustbe_exp ')'
+               {
+                 lang_add_assignment (exp_provide ($3, $5));
                }
-               
        ;
 
 
@@ -567,6 +574,8 @@ exp :
                        { $$ = exp_unop(ABSOLUTE, $3); }
        |       ALIGN_K '(' exp ')'
                        { $$ = exp_unop(ALIGN_K,$3); }
+       |       BLOCK '(' exp ')'
+                       { $$ = exp_unop(ALIGN_K,$3); }
        |       NAME
                        { $$ = exp_nameop(NAME,$1); }
        ;
@@ -585,10 +594,10 @@ section:  NAME            { ldlex_expression(); }
                        lang_enter_output_section_statement($1,$3,typebits,0,0,0,$4);
                        }
                statement_list_opt      
-               '}' {ldlex_expression();} fill_opt memspec_opt
+               '}' {ldlex_expression();} memspec_opt fill_opt
                {
                  ldlex_popstate();
-                 lang_leave_output_section_statement($11, $12);
+                 lang_leave_output_section_statement($12, $11);
                }
 opt_comma
 
@@ -621,8 +630,11 @@ void
 yyerror(arg) 
      const char *arg;
 { 
+  if (ldfile_assumed_script)
+    einfo ("%P:%s: file format not recognized; treating as linker script\n",
+          ldfile_input_filename);
   if (error_index > 0 && error_index < ERROR_NAME_MAX)
-     einfo("%P%F: %S %s in %s\n", arg, error_names[error_index-1]);
+     einfo ("%P%F:%S: %s in %s\n", arg, error_names[error_index-1]);
   else
-     einfo("%P%F: %S %s\n", arg);
+     einfo ("%P%F:%S: %s\n", arg);
 }
This page took 0.027154 seconds and 4 git commands to generate.