summaryrefslogtreecommitdiff
path: root/ld/ldmisc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2012-02-17 14:09:55 +0000
committerAlan Modra <amodra@bigpond.net.au>2012-02-17 14:09:55 +0000
commit488915c3aae8d8c37e397be0bfe4be8706d09ea5 (patch)
tree4993d454da63a9d187ae6a940ac813df643ccb88 /ld/ldmisc.c
parent29c4be2d9344b923f6df7adc4d63f431e3eed760 (diff)
downloadbinutils-redhat-488915c3aae8d8c37e397be0bfe4be8706d09ea5.tar.gz
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.
Diffstat (limited to 'ld/ldmisc.c')
-rw-r--r--ld/ldmisc.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/ld/ldmisc.c b/ld/ldmisc.c
index 12cb726d9a..21e6f4f84a 100644
--- a/ld/ldmisc.c
+++ b/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':