aboutsummaryrefslogtreecommitdiff
path: root/ld/ldgram.y
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-09-13 20:42:47 +0000
committerIan Lance Taylor <ian@airs.com>1994-09-13 20:42:47 +0000
commit0b3499f6721808b2f676a8caf8744002447c00b2 (patch)
tree54cd88586ebe8f2d7f23ab1f7e67ca13170c854e /ld/ldgram.y
parent204ba9e37eb78aebc70aec88d2a55b7893166f79 (diff)
downloadfsf-binutils-gdb-0b3499f6721808b2f676a8caf8744002447c00b2.zip
fsf-binutils-gdb-0b3499f6721808b2f676a8caf8744002447c00b2.tar.gz
fsf-binutils-gdb-0b3499f6721808b2f676a8caf8744002447c00b2.tar.bz2
* ldlang.c (load_symbols): Check for archive before object. Use
bfd_check_format_matches, and, if ambiguous, print a list of matching formats. If file format is not recognized, treat file as a linker script. * ldgram.y (yyerror): If assuming an object file is a script, mention that. Tweak the format of the error messages. * ldlex.l (lex_warn_invalid): If assuming an object is a script, guess that this is not actually a script, and just report that the file format was not recognized. * ld.texinfo (Options): Admit that -( may be used more than once. Add note that unrecognized object files are now treated as linker scripts. * ldfile.c (ldfile_input_filename): Make const. (ldfile_assumed_script): New variable. (try_open): Change arguments types to const. (ldfile_find_command_file): Likewise. (ldfile_open_command_file): Likewise. Also, set lineno to 1. * ldfile.h: Update declarations for ldfile.c changes. * ldlex.l: Include <ctype.h>. (file_name_stack): Change to be const char *. (lineno_stack): New static variable. (<<EOF>>): Set lineno as well as ldfile_input_filename. (lex_push_file): Make name argument const. Initialize lineno_stack entry. (lex_redirect): Initialize lineno_stack entry. (lex_warn_invalid): Handle non printable characters nicely. * ldlex.h (lex_push_file): Declare second argument as const. * ldgram.y (ifile_p1): Recognize GROUP. * ldlex.l: Recognize GROUP. * ld.texinfo (Option Commands): Document GROUP.
Diffstat (limited to 'ld/ldgram.y')
-rw-r--r--ld/ldgram.y31
1 files changed, 23 insertions, 8 deletions
diff --git a/ld/ldgram.y b/ld/ldgram.y
index 3e6ca0a..7d13971 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -102,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
@@ -249,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
@@ -402,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));
}
-
;
@@ -564,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); }
;
@@ -618,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);
}