mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 10:03:47 +08:00
PR ld/13343
* ld.h (parsing_defsym): Delete. * ldexp.c (exp_intop, exp_bigintop, exp_relop): Set type.filename. (fold_binary, fold_name, exp_fold_tree_1, exp_get_vma, exp_get_fill, exp_get_abs_int): Add tree arg for %S in error messages. Don't fudge lineno. (exp_binop, exp_unop, exp_nameop, exp_assop, exp_assert): Copy type.filename from sub-tree. (exp_trinop): Likewise, and use "cond" rather than "lhs". * ldexp.h (node_type): Add filename field to struct. * ldfile.c (ldfile_input_filename): Delete. Remove all refs. * ldfile.h (ldfile_input_filename): Delete. * ldgram.y (phdr_type, phdr_qualifiers, yyerror): Add NULL arg for %S in error messages. * ldemul.c (syslib_default, hll_default): Likewise. * ldlang.c (lang_memory_region_lookup, lang_memory_region_alias, lang_get_regions, lang_new_phdr): Likewise. (lang_size_sections_1): Pass addr_tree for %S. * ldlex.h (lex_redirect): Update prototype. (ldlex_filename): Declare. * ldlex.l (<EOF>): Don't set ldfile_input_filename. (lex_redirect): Add fake_filename and count params. Push fake_filename to file_name_stack and init lineno from count. (ldlex_filename): New function. (lex_warn_invalid): Use above. * ldmain.c (main): Update lex_redirect call. * ldmisc.c (vfinfo <%S>): Take file name and line number from etree_type arg, or use current if arg is NULL. * lexsup.c (parsing_defsym): Delete. (parse_args <OPTION_DEFSYM>): Update lex_redirect call.
This commit is contained in:
parent
9e50707687
commit
dab69f680b
33
ld/ChangeLog
33
ld/ChangeLog
@ -1,3 +1,36 @@
|
||||
2012-02-18 Alan Modra <amodra@gmail.com>
|
||||
|
||||
PR ld/13343
|
||||
* ld.h (parsing_defsym): Delete.
|
||||
* ldexp.c (exp_intop, exp_bigintop, exp_relop): Set type.filename.
|
||||
(fold_binary, fold_name, exp_fold_tree_1, exp_get_vma, exp_get_fill,
|
||||
exp_get_abs_int): Add tree arg for %S in error messages. Don't
|
||||
fudge lineno.
|
||||
(exp_binop, exp_unop, exp_nameop, exp_assop, exp_assert): Copy
|
||||
type.filename from sub-tree.
|
||||
(exp_trinop): Likewise, and use "cond" rather than "lhs".
|
||||
* ldexp.h (node_type): Add filename field to struct.
|
||||
* ldfile.c (ldfile_input_filename): Delete. Remove all refs.
|
||||
* ldfile.h (ldfile_input_filename): Delete.
|
||||
* ldgram.y (phdr_type, phdr_qualifiers, yyerror): Add NULL arg for
|
||||
%S in error messages.
|
||||
* ldemul.c (syslib_default, hll_default): Likewise.
|
||||
* ldlang.c (lang_memory_region_lookup, lang_memory_region_alias,
|
||||
lang_get_regions, lang_new_phdr): Likewise.
|
||||
(lang_size_sections_1): Pass addr_tree for %S.
|
||||
* ldlex.h (lex_redirect): Update prototype.
|
||||
(ldlex_filename): Declare.
|
||||
* ldlex.l (<EOF>): Don't set ldfile_input_filename.
|
||||
(lex_redirect): Add fake_filename and count params. Push
|
||||
fake_filename to file_name_stack and init lineno from count.
|
||||
(ldlex_filename): New function.
|
||||
(lex_warn_invalid): Use above.
|
||||
* ldmain.c (main): Update lex_redirect call.
|
||||
* ldmisc.c (vfinfo <%S>): Take file name and line number from
|
||||
etree_type arg, or use current if arg is NULL.
|
||||
* lexsup.c (parsing_defsym): Delete.
|
||||
(parse_args <OPTION_DEFSYM>): Update lex_redirect call.
|
||||
|
||||
2012-02-13 Kai Tietz <ktietz@redhat.com>
|
||||
|
||||
* deffilep.y (find_export_in_list): Set is_indent for
|
||||
|
5
ld/ld.h
5
ld/ld.h
@ -1,6 +1,6 @@
|
||||
/* ld.h -- general linker header file
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
@ -326,9 +326,6 @@ extern ld_config_type config;
|
||||
extern FILE * saved_script_handle;
|
||||
extern bfd_boolean force_make_executable;
|
||||
|
||||
/* Non-zero if we are processing a --defsym from the command line. */
|
||||
extern int parsing_defsym;
|
||||
|
||||
extern int yyparse (void);
|
||||
extern void add_cref (const char *, bfd *, asection *, bfd_vma);
|
||||
extern bfd_boolean handle_asneeded_cref (bfd *, enum notice_asneeded_action);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ldemul.c -- clearing house for ld emulation states
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2005, 2007, 2008, 2009, 2010, 2011
|
||||
2001, 2002, 2003, 2005, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
@ -262,13 +262,13 @@ set_output_arch_default (void)
|
||||
void
|
||||
syslib_default (char *ignore ATTRIBUTE_UNUSED)
|
||||
{
|
||||
info_msg (_("%S SYSLIB ignored\n"));
|
||||
info_msg (_("%S SYSLIB ignored\n"), NULL);
|
||||
}
|
||||
|
||||
void
|
||||
hll_default (char *ignore ATTRIBUTE_UNUSED)
|
||||
{
|
||||
info_msg (_("%S HLL ignored\n"));
|
||||
info_msg (_("%S HLL ignored\n"), NULL);
|
||||
}
|
||||
|
||||
ld_emulation_xfer_type *ld_emulations[] = { EMULATION_LIST };
|
||||
|
68
ld/ldexp.c
68
ld/ldexp.c
@ -1,6 +1,6 @@
|
||||
/* This module handles expression trees.
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
Free Software Foundation, Inc.
|
||||
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
|
||||
|
||||
@ -156,6 +156,7 @@ exp_intop (bfd_vma value)
|
||||
{
|
||||
etree_type *new_e = (etree_type *) stat_alloc (sizeof (new_e->value));
|
||||
new_e->type.node_code = INT;
|
||||
new_e->type.filename = ldlex_filename ();
|
||||
new_e->type.lineno = lineno;
|
||||
new_e->value.value = value;
|
||||
new_e->value.str = NULL;
|
||||
@ -168,6 +169,7 @@ exp_bigintop (bfd_vma value, char *str)
|
||||
{
|
||||
etree_type *new_e = (etree_type *) stat_alloc (sizeof (new_e->value));
|
||||
new_e->type.node_code = INT;
|
||||
new_e->type.filename = ldlex_filename ();
|
||||
new_e->type.lineno = lineno;
|
||||
new_e->value.value = value;
|
||||
new_e->value.str = str;
|
||||
@ -182,6 +184,7 @@ exp_relop (asection *section, bfd_vma value)
|
||||
{
|
||||
etree_type *new_e = (etree_type *) stat_alloc (sizeof (new_e->rel));
|
||||
new_e->type.node_code = REL;
|
||||
new_e->type.filename = ldlex_filename ();
|
||||
new_e->type.lineno = lineno;
|
||||
new_e->type.node_class = etree_rel;
|
||||
new_e->rel.section = section;
|
||||
@ -404,7 +407,7 @@ fold_binary (etree_type *tree)
|
||||
expld.result.value = ((bfd_signed_vma) lhs.value
|
||||
% (bfd_signed_vma) expld.result.value);
|
||||
else if (expld.phase != lang_mark_phase_enum)
|
||||
einfo (_("%F%S %% by zero\n"));
|
||||
einfo (_("%F%S %% by zero\n"), tree->binary.rhs);
|
||||
if (expld.result.section == lhs.section)
|
||||
expld.result.section = NULL;
|
||||
break;
|
||||
@ -414,7 +417,7 @@ fold_binary (etree_type *tree)
|
||||
expld.result.value = ((bfd_signed_vma) lhs.value
|
||||
/ (bfd_signed_vma) expld.result.value);
|
||||
else if (expld.phase != lang_mark_phase_enum)
|
||||
einfo (_("%F%S / by zero\n"));
|
||||
einfo (_("%F%S / by zero\n"), tree->binary.rhs);
|
||||
if (expld.result.section == lhs.section)
|
||||
expld.result.section = NULL;
|
||||
break;
|
||||
@ -590,7 +593,7 @@ fold_name (etree_type *tree)
|
||||
if (expld.phase != lang_mark_phase_enum)
|
||||
einfo (_("%X%S: unresolvable symbol `%s'"
|
||||
" referenced in expression\n"),
|
||||
tree->name.name);
|
||||
tree, tree->name.name);
|
||||
}
|
||||
else if (output_section == bfd_abs_section_ptr
|
||||
&& (expld.section != bfd_abs_section_ptr
|
||||
@ -602,8 +605,9 @@ fold_name (etree_type *tree)
|
||||
}
|
||||
else if (expld.phase == lang_final_phase_enum
|
||||
|| expld.assigning_to_dot)
|
||||
einfo (_("%F%S: undefined symbol `%s' referenced in expression\n"),
|
||||
tree->name.name);
|
||||
einfo (_("%F%S: undefined symbol `%s'"
|
||||
" referenced in expression\n"),
|
||||
tree, tree->name.name);
|
||||
else if (h->type == bfd_link_hash_new)
|
||||
{
|
||||
h->type = bfd_link_hash_undefined;
|
||||
@ -623,8 +627,9 @@ fold_name (etree_type *tree)
|
||||
if (os == NULL)
|
||||
{
|
||||
if (expld.phase == lang_final_phase_enum)
|
||||
einfo (_("%F%S: undefined section `%s' referenced in expression\n"),
|
||||
tree->name.name);
|
||||
einfo (_("%F%S: undefined section `%s'"
|
||||
" referenced in expression\n"),
|
||||
tree, tree->name.name);
|
||||
}
|
||||
else if (os->processed_vma)
|
||||
new_rel (0, os->bfd_section);
|
||||
@ -640,8 +645,9 @@ fold_name (etree_type *tree)
|
||||
if (os == NULL)
|
||||
{
|
||||
if (expld.phase == lang_final_phase_enum)
|
||||
einfo (_("%F%S: undefined section `%s' referenced in expression\n"),
|
||||
tree->name.name);
|
||||
einfo (_("%F%S: undefined section `%s'"
|
||||
" referenced in expression\n"),
|
||||
tree, tree->name.name);
|
||||
}
|
||||
else if (os->processed_lma)
|
||||
{
|
||||
@ -667,8 +673,9 @@ fold_name (etree_type *tree)
|
||||
if (os == NULL)
|
||||
{
|
||||
if (expld.phase == lang_final_phase_enum)
|
||||
einfo (_("%F%S: undefined section `%s' referenced in expression\n"),
|
||||
tree->name.name);
|
||||
einfo (_("%F%S: undefined section `%s'"
|
||||
" referenced in expression\n"),
|
||||
tree, tree->name.name);
|
||||
new_number (0);
|
||||
}
|
||||
else if (os->processed_vma)
|
||||
@ -695,7 +702,8 @@ fold_name (etree_type *tree)
|
||||
new_number (mem->length);
|
||||
else
|
||||
einfo (_("%F%S: undefined MEMORY region `%s'"
|
||||
" referenced in expression\n"), tree->name.name);
|
||||
" referenced in expression\n"),
|
||||
tree, tree->name.name);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -709,7 +717,8 @@ fold_name (etree_type *tree)
|
||||
new_rel_from_abs (mem->origin);
|
||||
else
|
||||
einfo (_("%F%S: undefined MEMORY region `%s'"
|
||||
" referenced in expression\n"), tree->name.name);
|
||||
" referenced in expression\n"),
|
||||
tree, tree->name.name);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -720,7 +729,7 @@ fold_name (etree_type *tree)
|
||||
new_number (config.commonpagesize);
|
||||
else
|
||||
einfo (_("%F%S: unknown constant `%s' referenced in expression\n"),
|
||||
tree->name.name);
|
||||
tree, tree->name.name);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -784,7 +793,8 @@ exp_fold_tree_1 (etree_type *tree)
|
||||
if (tree->assign.dst[0] == '.' && tree->assign.dst[1] == 0)
|
||||
{
|
||||
if (tree->type.node_class != etree_assign)
|
||||
einfo (_("%F%S can not PROVIDE assignment to location counter\n"));
|
||||
einfo (_("%F%S can not PROVIDE assignment to"
|
||||
" location counter\n"), tree);
|
||||
/* After allocation, assignment to dot should not be done inside
|
||||
an output section since allocation adds a padding statement
|
||||
that effectively duplicates the assignment. */
|
||||
@ -802,11 +812,12 @@ exp_fold_tree_1 (etree_type *tree)
|
||||
if (!expld.result.valid_p)
|
||||
{
|
||||
if (expld.phase != lang_mark_phase_enum)
|
||||
einfo (_("%F%S invalid assignment to location counter\n"));
|
||||
einfo (_("%F%S invalid assignment to"
|
||||
" location counter\n"), tree);
|
||||
}
|
||||
else if (expld.dotp == NULL)
|
||||
einfo (_("%F%S assignment to location counter"
|
||||
" invalid outside of SECTION\n"));
|
||||
" invalid outside of SECTION\n"), tree);
|
||||
else
|
||||
{
|
||||
bfd_vma nextdot;
|
||||
@ -819,7 +830,8 @@ exp_fold_tree_1 (etree_type *tree)
|
||||
if (nextdot < expld.dot
|
||||
&& expld.section != bfd_abs_section_ptr)
|
||||
einfo (_("%F%S cannot move location counter backwards"
|
||||
" (from %V to %V)\n"), expld.dot, nextdot);
|
||||
" (from %V to %V)\n"),
|
||||
tree, expld.dot, nextdot);
|
||||
else
|
||||
{
|
||||
expld.dot = nextdot;
|
||||
@ -955,6 +967,7 @@ exp_binop (int code, etree_type *lhs, etree_type *rhs)
|
||||
etree_type value, *new_e;
|
||||
|
||||
value.type.node_code = code;
|
||||
value.type.filename = lhs->type.filename;
|
||||
value.type.lineno = lhs->type.lineno;
|
||||
value.binary.lhs = lhs;
|
||||
value.binary.rhs = rhs;
|
||||
@ -974,7 +987,8 @@ exp_trinop (int code, etree_type *cond, etree_type *lhs, etree_type *rhs)
|
||||
etree_type value, *new_e;
|
||||
|
||||
value.type.node_code = code;
|
||||
value.type.lineno = lhs->type.lineno;
|
||||
value.type.filename = cond->type.filename;
|
||||
value.type.lineno = cond->type.lineno;
|
||||
value.trinary.lhs = lhs;
|
||||
value.trinary.cond = cond;
|
||||
value.trinary.rhs = rhs;
|
||||
@ -994,6 +1008,7 @@ exp_unop (int code, etree_type *child)
|
||||
etree_type value, *new_e;
|
||||
|
||||
value.unary.type.node_code = code;
|
||||
value.unary.type.filename = child->type.filename;
|
||||
value.unary.type.lineno = child->type.lineno;
|
||||
value.unary.child = child;
|
||||
value.unary.type.node_class = etree_unary;
|
||||
@ -1012,6 +1027,7 @@ exp_nameop (int code, const char *name)
|
||||
etree_type value, *new_e;
|
||||
|
||||
value.name.type.node_code = code;
|
||||
value.name.type.filename = ldlex_filename ();
|
||||
value.name.type.lineno = lineno;
|
||||
value.name.name = name;
|
||||
value.name.type.node_class = etree_name;
|
||||
@ -1036,6 +1052,7 @@ exp_assop (const char *dst,
|
||||
|
||||
n = (etree_type *) stat_alloc (sizeof (n->assign));
|
||||
n->assign.type.node_code = '=';
|
||||
n->assign.type.filename = src->type.filename;
|
||||
n->assign.type.lineno = src->type.lineno;
|
||||
n->assign.type.node_class = class;
|
||||
n->assign.src = src;
|
||||
@ -1073,6 +1090,7 @@ exp_assert (etree_type *exp, const char *message)
|
||||
|
||||
n = (etree_type *) stat_alloc (sizeof (n->assert_s));
|
||||
n->assert_s.type.node_code = '!';
|
||||
n->assert_s.type.filename = exp->type.filename;
|
||||
n->assert_s.type.lineno = exp->type.lineno;
|
||||
n->assert_s.type.node_class = etree_assert;
|
||||
n->assert_s.child = exp;
|
||||
@ -1188,7 +1206,8 @@ exp_get_vma (etree_type *tree, bfd_vma def, char *name)
|
||||
if (expld.result.valid_p)
|
||||
return expld.result.value;
|
||||
else if (name != NULL && expld.phase != lang_mark_phase_enum)
|
||||
einfo (_("%F%S: nonconstant expression for %s\n"), name);
|
||||
einfo (_("%F%S: nonconstant expression for %s\n"),
|
||||
tree, name);
|
||||
}
|
||||
return def;
|
||||
}
|
||||
@ -1213,7 +1232,8 @@ exp_get_fill (etree_type *tree, fill_type *def, char *name)
|
||||
if (!expld.result.valid_p)
|
||||
{
|
||||
if (name != NULL && expld.phase != lang_mark_phase_enum)
|
||||
einfo (_("%F%S: nonconstant expression for %s\n"), name);
|
||||
einfo (_("%F%S: nonconstant expression for %s\n"),
|
||||
tree, name);
|
||||
return def;
|
||||
}
|
||||
|
||||
@ -1272,8 +1292,8 @@ exp_get_abs_int (etree_type *tree, int def, char *name)
|
||||
}
|
||||
else if (name != NULL && expld.phase != lang_mark_phase_enum)
|
||||
{
|
||||
lineno = tree->type.lineno;
|
||||
einfo (_("%F%S: nonconstant expression for %s\n"), name);
|
||||
einfo (_("%F%S: nonconstant expression for %s\n"),
|
||||
tree, name);
|
||||
}
|
||||
}
|
||||
return def;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ldexp.h -
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2007, 2011 Free Software Foundation, Inc.
|
||||
2003, 2004, 2005, 2007, 2011, 2012 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
|
||||
@ -46,6 +46,7 @@ enum node_tree_enum {
|
||||
typedef struct {
|
||||
int node_code;
|
||||
unsigned int lineno;
|
||||
const char *filename;
|
||||
enum node_tree_enum node_class;
|
||||
} node_type;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Linker file opening and searching.
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
|
||||
2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
@ -40,7 +40,6 @@
|
||||
#include "plugin.h"
|
||||
#endif /* ENABLE_PLUGINS */
|
||||
|
||||
const char * ldfile_input_filename;
|
||||
bfd_boolean ldfile_assumed_script = FALSE;
|
||||
const char * ldfile_output_machine_name = "";
|
||||
unsigned long ldfile_output_machine;
|
||||
@ -638,7 +637,6 @@ ldfile_open_command_file_1 (const char *name, bfd_boolean default_only)
|
||||
|
||||
lex_push_file (ldlex_input_stack, name);
|
||||
|
||||
ldfile_input_filename = name;
|
||||
lineno = 1;
|
||||
|
||||
saved_script_handle = ldlex_input_stack;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ldfile.h -
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 2000, 2002, 2003, 2004, 2005, 2007
|
||||
Free Software Foundation, Inc.
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 2000, 2002, 2003, 2004, 2005,
|
||||
2007, 2012 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
#ifndef LDFILE_H
|
||||
#define LDFILE_H
|
||||
|
||||
extern const char *ldfile_input_filename;
|
||||
extern bfd_boolean ldfile_assumed_script;
|
||||
extern unsigned long ldfile_output_machine;
|
||||
extern enum bfd_architecture ldfile_output_architecture;
|
||||
|
13
ld/ldgram.y
13
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, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
Free Software Foundation, Inc.
|
||||
Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
|
||||
|
||||
@ -1219,7 +1219,7 @@ phdr_type:
|
||||
{
|
||||
einfo (_("\
|
||||
%X%P:%S: unknown phdr type `%s' (try integer literal)\n"),
|
||||
s);
|
||||
NULL, s);
|
||||
$$ = exp_intop (0);
|
||||
}
|
||||
}
|
||||
@ -1242,7 +1242,8 @@ phdr_qualifiers:
|
||||
else if (strcmp ($1, "FLAGS") == 0 && $2 != NULL)
|
||||
$$.flags = $2;
|
||||
else
|
||||
einfo (_("%X%P:%S: PHDRS syntax error at `%s'\n"), $1);
|
||||
einfo (_("%X%P:%S: PHDRS syntax error at `%s'\n"),
|
||||
NULL, $1);
|
||||
}
|
||||
| AT '(' exp ')' phdr_qualifiers
|
||||
{
|
||||
@ -1448,9 +1449,9 @@ yyerror(arg)
|
||||
{
|
||||
if (ldfile_assumed_script)
|
||||
einfo (_("%P:%s: file format not recognized; treating as linker script\n"),
|
||||
ldfile_input_filename);
|
||||
ldlex_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", NULL, arg, error_names[error_index - 1]);
|
||||
else
|
||||
einfo ("%P%F:%S: %s\n", arg);
|
||||
einfo ("%P%F:%S: %s\n", NULL, arg);
|
||||
}
|
||||
|
20
ld/ldlang.c
20
ld/ldlang.c
@ -1312,12 +1312,13 @@ lang_memory_region_lookup (const char *const name, bfd_boolean create)
|
||||
{
|
||||
if (create)
|
||||
einfo (_("%P:%S: warning: redeclaration of memory region `%s'\n"),
|
||||
name);
|
||||
NULL, name);
|
||||
return r;
|
||||
}
|
||||
|
||||
if (!create && strcmp (name, DEFAULT_MEMORY_REGION))
|
||||
einfo (_("%P:%S: warning: memory region `%s' not declared\n"), name);
|
||||
einfo (_("%P:%S: warning: memory region `%s' not declared\n"),
|
||||
NULL, name);
|
||||
|
||||
new_region = (lang_memory_region_type *)
|
||||
stat_alloc (sizeof (lang_memory_region_type));
|
||||
@ -1351,7 +1352,7 @@ lang_memory_region_alias (const char * alias, const char * region_name)
|
||||
the default memory region. */
|
||||
if (strcmp (region_name, DEFAULT_MEMORY_REGION) == 0
|
||||
|| strcmp (alias, DEFAULT_MEMORY_REGION) == 0)
|
||||
einfo (_("%F%P:%S: error: alias for default memory region\n"));
|
||||
einfo (_("%F%P:%S: error: alias for default memory region\n"), NULL);
|
||||
|
||||
/* Look for the target region and check if the alias is not already
|
||||
in use. */
|
||||
@ -1364,15 +1365,14 @@ lang_memory_region_alias (const char * alias, const char * region_name)
|
||||
if (strcmp (n->name, alias) == 0)
|
||||
einfo (_("%F%P:%S: error: redefinition of memory region "
|
||||
"alias `%s'\n"),
|
||||
alias);
|
||||
NULL, alias);
|
||||
}
|
||||
|
||||
/* Check if the target region exists. */
|
||||
if (region == NULL)
|
||||
einfo (_("%F%P:%S: error: memory region `%s' "
|
||||
"for alias `%s' does not exist\n"),
|
||||
region_name,
|
||||
alias);
|
||||
NULL, region_name, alias);
|
||||
|
||||
/* Add alias to region name list. */
|
||||
n = (lang_memory_region_name *) stat_alloc (sizeof (lang_memory_region_name));
|
||||
@ -4891,7 +4891,7 @@ lang_size_sections_1
|
||||
else if (expld.phase != lang_mark_phase_enum)
|
||||
einfo (_("%F%S: non constant or forward reference"
|
||||
" address expression for section %s\n"),
|
||||
os->name);
|
||||
os->addr_tree, os->name);
|
||||
}
|
||||
|
||||
if (os->bfd_section == NULL)
|
||||
@ -6948,7 +6948,8 @@ lang_get_regions (lang_memory_region_type **region,
|
||||
*region = lang_memory_region_lookup (memspec, FALSE);
|
||||
|
||||
if (have_lma && lma_memspec != 0)
|
||||
einfo (_("%X%P:%S: section has both a load address and a load region\n"));
|
||||
einfo (_("%X%P:%S: section has both a load address and a load region\n"),
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -7135,7 +7136,8 @@ lang_new_phdr (const char *name,
|
||||
&& (*pp)->type == 1
|
||||
&& !((*pp)->filehdr || (*pp)->phdrs))
|
||||
{
|
||||
einfo (_("%X%P:%S: PHDRS and FILEHDR are not supported when prior PT_LOAD headers lack them\n"));
|
||||
einfo (_("%X%P:%S: PHDRS and FILEHDR are not supported"
|
||||
" when prior PT_LOAD headers lack them\n"), NULL);
|
||||
hdrs = FALSE;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ldlex.h -
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1997, 2000, 2003, 2005, 2006, 2007
|
||||
Free Software Foundation, Inc.
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1997, 2000, 2003, 2005, 2006,
|
||||
2007, 2012 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
|
||||
@ -42,7 +42,7 @@ extern const char *lex_string;
|
||||
/* In ldlex.l. */
|
||||
extern int yylex (void);
|
||||
extern void lex_push_file (FILE *, const char *);
|
||||
extern void lex_redirect (const char *);
|
||||
extern void lex_redirect (const char *, const char *, unsigned int);
|
||||
extern void ldlex_script (void);
|
||||
extern void ldlex_mri_script (void);
|
||||
extern void ldlex_version_script (void);
|
||||
@ -52,6 +52,7 @@ extern void ldlex_expression (void);
|
||||
extern void ldlex_both (void);
|
||||
extern void ldlex_command (void);
|
||||
extern void ldlex_popstate (void);
|
||||
extern const char* ldlex_filename (void);
|
||||
|
||||
/* In lexsup.c. */
|
||||
extern int lex_input (void);
|
||||
|
27
ld/ldlex.l
27
ld/ldlex.l
@ -3,7 +3,7 @@
|
||||
%{
|
||||
|
||||
/* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
Free Software Foundation, Inc.
|
||||
Written by Steve Chamberlain of Cygnus Support.
|
||||
|
||||
@ -448,17 +448,11 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
|
||||
|
||||
<<EOF>> {
|
||||
include_stack_ptr--;
|
||||
|
||||
if (include_stack_ptr == 0)
|
||||
{
|
||||
yyterminate ();
|
||||
}
|
||||
else
|
||||
{
|
||||
yy_switch_to_buffer (include_stack[include_stack_ptr]);
|
||||
}
|
||||
|
||||
ldfile_input_filename = file_name_stack[include_stack_ptr - 1];
|
||||
lineno = lineno_stack[include_stack_ptr];
|
||||
|
||||
return END;
|
||||
@ -534,7 +528,7 @@ yy_create_string_buffer (const char *string, size_t size)
|
||||
on the include stack. */
|
||||
|
||||
void
|
||||
lex_redirect (const char *string)
|
||||
lex_redirect (const char *string, const char *fake_filename, unsigned int count)
|
||||
{
|
||||
YY_BUFFER_STATE tmp;
|
||||
|
||||
@ -543,11 +537,11 @@ lex_redirect (const char *string)
|
||||
{
|
||||
einfo("%F: macros nested too deeply\n");
|
||||
}
|
||||
file_name_stack[include_stack_ptr] = "redirect";
|
||||
file_name_stack[include_stack_ptr] = fake_filename;
|
||||
lineno_stack[include_stack_ptr] = lineno;
|
||||
include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
|
||||
include_stack_ptr++;
|
||||
lineno = 1;
|
||||
lineno = count;
|
||||
tmp = yy_create_string_buffer (string, strlen (string));
|
||||
yy_switch_to_buffer (tmp);
|
||||
}
|
||||
@ -612,6 +606,15 @@ ldlex_popstate (void)
|
||||
{
|
||||
yy_start = *(--state_stack_p);
|
||||
}
|
||||
|
||||
/* Return the current file name, or the previous file if no file is
|
||||
current. */
|
||||
|
||||
const char*
|
||||
ldlex_filename (void)
|
||||
{
|
||||
return file_name_stack[include_stack_ptr - (include_stack_ptr != 0)];
|
||||
}
|
||||
|
||||
|
||||
/* Place up to MAX_SIZE characters in BUF and return
|
||||
@ -685,7 +688,7 @@ lex_warn_invalid (char *where, char *what)
|
||||
if (ldfile_assumed_script)
|
||||
{
|
||||
bfd_set_error (bfd_error_file_not_recognized);
|
||||
einfo ("%F%s: file not recognized: %E\n", ldfile_input_filename);
|
||||
einfo ("%F%s: file not recognized: %E\n", ldlex_filename ());
|
||||
}
|
||||
|
||||
if (! ISPRINT (*what))
|
||||
@ -694,5 +697,5 @@ lex_warn_invalid (char *where, char *what)
|
||||
what = buf;
|
||||
}
|
||||
|
||||
einfo ("%P:%S: ignoring invalid character `%s'%s\n", what, where);
|
||||
einfo ("%P:%S: ignoring invalid character `%s'%s\n", NULL, what, where);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Main program of GNU linker.
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
Free Software Foundation, Inc.
|
||||
Written by Steve Chamberlain steve@cygnus.com
|
||||
|
||||
@ -327,7 +327,7 @@ main (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
lex_string = s;
|
||||
lex_redirect (s);
|
||||
lex_redirect (s, _("built in linker script"), 1);
|
||||
}
|
||||
parser_input = input_script;
|
||||
yyparse ();
|
||||
|
23
ld/ldmisc.c
23
ld/ldmisc.c
@ -1,6 +1,6 @@
|
||||
/* ldmisc.c
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012
|
||||
Free Software Foundation, Inc.
|
||||
Written by Steve Chamberlain of Cygnus Support.
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
%I filename from a lang_input_statement_type
|
||||
%P print program name
|
||||
%R info about a relent
|
||||
%S print script file and linenumber
|
||||
%S print script file and linenumber from etree_type.
|
||||
%T symbol name
|
||||
%V hex bfd_vma
|
||||
%W hex bfd_vma with 0x with no leading zeros taking up 8 spaces
|
||||
@ -240,12 +240,19 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
|
||||
|
||||
case 'S':
|
||||
/* Print script file and linenumber. */
|
||||
if (parsing_defsym)
|
||||
fprintf (fp, "--defsym %s", lex_string);
|
||||
else if (ldfile_input_filename != NULL)
|
||||
fprintf (fp, "%s:%u", ldfile_input_filename, lineno);
|
||||
else
|
||||
fprintf (fp, _("built in linker script:%u"), lineno);
|
||||
{
|
||||
node_type node;
|
||||
etree_type *tp = va_arg (arg, etree_type *);
|
||||
|
||||
if (tp == NULL)
|
||||
{
|
||||
tp = (etree_type *) &node;
|
||||
tp->type.filename = ldlex_filename ();
|
||||
tp->type.lineno = lineno;
|
||||
}
|
||||
if (tp->type.filename != NULL)
|
||||
fprintf (fp, "%s:%u", tp->type.filename, tp->type.lineno);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
|
10
ld/lexsup.c
10
ld/lexsup.c
@ -1,6 +1,6 @@
|
||||
/* Parse options for the GNU linker.
|
||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Binutils.
|
||||
@ -62,9 +62,6 @@ static void set_section_start (char *, char *);
|
||||
static void set_segment_start (const char *, char *);
|
||||
static void help (void);
|
||||
|
||||
/* Non-zero if we are processing a --defsym from the command line. */
|
||||
int parsing_defsym = 0;
|
||||
|
||||
/* Codes used for the long options with no short synonyms. 150 isn't
|
||||
special; it's just an arbitrary non-ASCII char value. */
|
||||
enum option_values
|
||||
@ -729,6 +726,7 @@ parse_args (unsigned argc, char **argv)
|
||||
{
|
||||
int longind;
|
||||
int optc;
|
||||
static unsigned int defsym_count;
|
||||
|
||||
/* Using last_optind lets us avoid calling ldemul_parse_args
|
||||
multiple times on a single option, which would lead to
|
||||
@ -823,11 +821,9 @@ parse_args (unsigned argc, char **argv)
|
||||
break;
|
||||
case OPTION_DEFSYM:
|
||||
lex_string = optarg;
|
||||
lex_redirect (optarg);
|
||||
lex_redirect (optarg, "--defsym", ++defsym_count);
|
||||
parser_input = input_defsym;
|
||||
parsing_defsym = 1;
|
||||
yyparse ();
|
||||
parsing_defsym = 0;
|
||||
lex_string = NULL;
|
||||
break;
|
||||
case OPTION_DEMANGLE:
|
||||
|
Loading…
Reference in New Issue
Block a user