* ldmain.c (main): Flush stdout before and stderr after printing

message.
	* ldmisc.c (einfo): Similarly.
	* plugin.c (message): Likewise.
	* emultempl/ppc64elf.em: Likewise.
	* emultempl/xtensaelf.em: Likewise.
	* emulparams/elf32mcore.sh: Use einfo rather than printf.
	* emultempl/beos.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
This commit is contained in:
Alan Modra
2011-01-14 12:37:17 +00:00
parent 4a97a0e54c
commit e922bcabdf
10 changed files with 31 additions and 27 deletions

View File

@ -1,3 +1,16 @@
2011-01-14 Alan Modra <amodra@gmail.com>
* ldmain.c (main): Flush stdout before and stderr after printing
message.
* ldmisc.c (einfo): Similarly.
* plugin.c (message): Likewise.
* emultempl/ppc64elf.em: Likewise.
* emultempl/xtensaelf.em: Likewise.
* emulparams/elf32mcore.sh: Use einfo rather than printf.
* emultempl/beos.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
2011-01-14 Alan Modra <amodra@gmail.com> 2011-01-14 Alan Modra <amodra@gmail.com>
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't

View File

@ -49,11 +49,6 @@ PARSE_AND_LIST_ARGS_CASES='
case OPTION_BASE_FILE: case OPTION_BASE_FILE:
link_info.base_file = fopen (optarg, FOPEN_WB); link_info.base_file = fopen (optarg, FOPEN_WB);
if (link_info.base_file == NULL) if (link_info.base_file == NULL)
{ einfo (_("%F%P: cannot open base file %s\n"), optarg);
/* xgettext:c-format */
fprintf (stderr, _("%s: Cannot open base file %s\n"),
program_name, optarg);
xexit (1);
}
break; break;
' '

View File

@ -270,11 +270,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
case OPTION_BASE_FILE: case OPTION_BASE_FILE:
link_info.base_file = fopen (optarg, FOPEN_WB); link_info.base_file = fopen (optarg, FOPEN_WB);
if (link_info.base_file == NULL) if (link_info.base_file == NULL)
{ einfo (_("%F%P: cannot open base file %s\n"), optarg);
fprintf (stderr, "%s: Can't open base file %s\n",
program_name, optarg);
xexit (1);
}
break; break;
/* PE options */ /* PE options */

View File

@ -688,12 +688,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
case OPTION_BASE_FILE: case OPTION_BASE_FILE:
link_info.base_file = fopen (optarg, FOPEN_WB); link_info.base_file = fopen (optarg, FOPEN_WB);
if (link_info.base_file == NULL) if (link_info.base_file == NULL)
{ einfo (_("%F%P: cannot open base file %s\n"), optarg);
/* xgettext:c-format */
fprintf (stderr, _("%s: Can't open base file %s\n"),
program_name, optarg);
xexit (1);
}
break; break;
/* PE options. */ /* PE options. */

View File

@ -611,12 +611,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
case OPTION_BASE_FILE: case OPTION_BASE_FILE:
link_info.base_file = fopen (optarg, FOPEN_WB); link_info.base_file = fopen (optarg, FOPEN_WB);
if (link_info.base_file == NULL) if (link_info.base_file == NULL)
{ einfo (_("%F%P: cannot open base file %s\n"), optarg);
/* xgettext:c-format */
fprintf (stderr, _("%s: Can't open base file %s\n"),
program_name, optarg);
xexit (1);
}
break; break;
/* PE options. */ /* PE options. */

View File

@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*- # This shell script emits a C file. -*- C -*-
# Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
# #
# This file is part of the GNU Binutils. # This file is part of the GNU Binutils.
@ -545,6 +545,7 @@ gld${EMULATION_NAME}_finish (void)
config.stats ? &msg : NULL)) config.stats ? &msg : NULL))
einfo ("%X%P: can not build stubs: %E\n"); einfo ("%X%P: can not build stubs: %E\n");
fflush (stdout);
for (line = msg; line != NULL; line = endline) for (line = msg; line != NULL; line = endline)
{ {
endline = strchr (line, '\n'); endline = strchr (line, '\n');
@ -552,6 +553,7 @@ gld${EMULATION_NAME}_finish (void)
*endline++ = '\0'; *endline++ = '\0';
fprintf (stderr, "%s: %s\n", program_name, line); fprintf (stderr, "%s: %s\n", program_name, line);
} }
fflush (stderr);
if (msg != NULL) if (msg != NULL)
free (msg); free (msg);
} }

View File

@ -1817,8 +1817,10 @@ ld_local_file_relocations_fit (lang_statement_union_type *statement,
bfd_vma target_addr = e->tgt->output_offset & ~3; bfd_vma target_addr = e->tgt->output_offset & ~3;
if (l32r_addr < target_addr) if (l32r_addr < target_addr)
{ {
fflush (stdout);
fprintf (stderr, "Warning: " fprintf (stderr, "Warning: "
"l32r target section before l32r\n"); "l32r target section before l32r\n");
fflush (stderr);
return FALSE; return FALSE;
} }

View File

@ -1,6 +1,6 @@
/* Main program of GNU linker. /* Main program of GNU linker.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com Written by Steve Chamberlain steve@cygnus.com
@ -551,12 +551,14 @@ main (int argc, char **argv)
#endif #endif
long run_time = get_run_time () - start_time; long run_time = get_run_time () - start_time;
fflush (stdout);
fprintf (stderr, _("%s: total time in link: %ld.%06ld\n"), fprintf (stderr, _("%s: total time in link: %ld.%06ld\n"),
program_name, run_time / 1000000, run_time % 1000000); program_name, run_time / 1000000, run_time % 1000000);
#ifdef HAVE_SBRK #ifdef HAVE_SBRK
fprintf (stderr, _("%s: data size %ld\n"), program_name, fprintf (stderr, _("%s: data size %ld\n"), program_name,
(long) (lim - (char *) &environ)); (long) (lim - (char *) &environ));
#endif #endif
fflush (stderr);
} }
/* Prevent remove_output from doing anything, after a successful link. */ /* Prevent remove_output from doing anything, after a successful link. */

View File

@ -1,6 +1,6 @@
/* ldmisc.c /* ldmisc.c
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support. Written by Steve Chamberlain of Cygnus Support.
@ -440,9 +440,11 @@ einfo (const char *fmt, ...)
{ {
va_list arg; va_list arg;
fflush (stdout);
va_start (arg, fmt); va_start (arg, fmt);
vfinfo (stderr, fmt, arg, TRUE); vfinfo (stderr, fmt, arg, TRUE);
va_end (arg); va_end (arg);
fflush (stderr);
} }
void void

View File

@ -1,5 +1,5 @@
/* Plugin control for the GNU linker. /* Plugin control for the GNU linker.
Copyright 2010 Free Software Foundation, Inc. Copyright 2010, 2011 Free Software Foundation, Inc.
This file is part of the GNU Binutils. This file is part of the GNU Binutils.
@ -596,7 +596,9 @@ message (int level, const char *format, ...)
char *newfmt = ACONCAT ((level == LDPL_FATAL char *newfmt = ACONCAT ((level == LDPL_FATAL
? "%P%F: " : "%P%X: ", ? "%P%F: " : "%P%X: ",
format, "\n", NULL)); format, "\n", NULL));
fflush (stdout);
vfinfo (stderr, newfmt, args, TRUE); vfinfo (stderr, newfmt, args, TRUE);
fflush (stderr);
} }
break; break;
} }