This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR 4992, stdout/stderr flushing


PR 4992 was regarding insertion of stderr output in the middle of
buffered stdout output, when both streams were redirected to the same
file.  This patches some other error reporting functions to similarly
flush stdout before writing to stderr.  For good measure, I also flush
stderr afterwards too.

bfd/
	* bfd.c (bfd_perror): Flush stdout before and stderr after printing
	error.
	(_bfd_default_error_handler): Likewise.
	* elf.c (print_segment_map): Likewise.
	* libbfd.c (warn_deprecated): Likewise.
	* som.c (som_sizeof_headers): No need to do so here.
	* coff-i860.c: Replace use of printf for error messages with
	_bfd_error_handler.
	* coff-ppc.c: Likewise.
	* coff-sh.c: Likewise.
	* elf32-bfin.c: Likewise.
	* elf32-dlx.c: Likewise.
	* elf32-mep.c: Likewise.
	* elf32-v850.c: Likewise.
	* mach-o.c: Likewise.
	* pef.c: Likewise.
ld/
	* 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.

Index: bfd/bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.114
diff -u -p -r1.114 bfd.c
--- bfd/bfd.c	3 Nov 2010 02:31:02 -0000	1.114
+++ bfd/bfd.c	14 Jan 2011 06:57:30 -0000
@@ -523,10 +523,12 @@ DESCRIPTION
 void
 bfd_perror (const char *message)
 {
+  fflush (stdout);
   if (message == NULL || *message == '\0')
     fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ()));
   else
     fprintf (stderr, "%s: %s\n", message, bfd_errmsg (bfd_get_error ()));
+  fflush (stderr);
 }
 
 /*
@@ -723,6 +725,7 @@ _bfd_default_error_handler (const char *
   va_end (ap);
 
   putc ('\n', stderr);
+  fflush (stderr);
 }
 
 /* This is a function pointer to the routine which should handle BFD
Index: bfd/coff-i860.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-i860.c,v
retrieving revision 1.24
diff -u -p -r1.24 coff-i860.c
--- bfd/coff-i860.c	27 Jun 2010 04:07:51 -0000	1.24
+++ bfd/coff-i860.c	14 Jan 2011 06:57:30 -0000
@@ -144,7 +144,7 @@ coff_i860_reloc_nyi (bfd *abfd ATTRIBUTE
 		     char **error_message ATTRIBUTE_UNUSED)
 {
   reloc_howto_type *howto = reloc_entry->howto;
-  fprintf (stderr, _("Relocation `%s' not yet implemented\n"), howto->name);
+  (*_bfd_error_handler) (_("relocation `%s' not yet implemented"), howto->name);
   return bfd_reloc_notsupported;
 }
 
Index: bfd/coff-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-ppc.c,v
retrieving revision 1.38
diff -u -p -r1.38 coff-ppc.c
--- bfd/coff-ppc.c	27 Jun 2010 04:07:51 -0000	1.38
+++ bfd/coff-ppc.c	14 Jan 2011 06:57:31 -0000
@@ -1843,10 +1843,9 @@ ppc_coff_rtype2howto (relent, internal)
 	howto = ppc_coff_howto_table + IMAGE_REL_PPC_TOCREL16;
       break;
     default:
-      fprintf (stderr,
-	      _("Warning: Unsupported reloc %s [%d] used -- it may not work.\n"),
-	      ppc_coff_howto_table[r_type].name,
-	      r_type);
+      (*_bfd_error_handler) (_("warning: unsupported reloc %s [%d] used -- it may not work"),
+			     ppc_coff_howto_table[r_type].name,
+			     r_type);
       howto = ppc_coff_howto_table + r_type;
       break;
     }
@@ -1916,10 +1915,9 @@ coff_ppc_rtype_to_howto (abfd, sec, rel,
       howto = ppc_coff_howto_table + r_type;
       break;
     default:
-      fprintf (stderr,
-	      _("Warning: Unsupported reloc %s [%d] used -- it may not work.\n"),
-	      ppc_coff_howto_table[r_type].name,
-	      r_type);
+      (*_bfd_error_handler) (_("warning: unsupported reloc %s [%d] used -- it may not work"),
+			     ppc_coff_howto_table[r_type].name,
+			     r_type);
       howto = ppc_coff_howto_table + r_type;
       break;
     }
Index: bfd/coff-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-sh.c,v
retrieving revision 1.41
diff -u -p -r1.41 coff-sh.c
--- bfd/coff-sh.c	2 Sep 2009 07:18:36 -0000	1.41
+++ bfd/coff-sh.c	14 Jan 2011 06:57:32 -0000
@@ -517,7 +517,7 @@ sh_coff_reloc_type_lookup (abfd, code)
     if (sh_reloc_map[i].bfd_reloc_val == code)
       return &sh_coff_howtos[(int) sh_reloc_map[i].shcoff_reloc_val];
 
-  fprintf (stderr, "SH Error: unknown reloc type %d\n", code);
+  (*_bfd_error_handler) (_("SH Error: unknown reloc type %d"), code);
   return NULL;
 }
 
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.527
diff -u -p -r1.527 elf.c
--- bfd/elf.c	15 Dec 2010 14:56:40 -0000	1.527
+++ bfd/elf.c	14 Jan 2011 06:57:37 -0000
@@ -4280,10 +4280,12 @@ print_segment_map (const struct elf_segm
 		  (unsigned int) m->p_type);
       pt = buf;
     }
+  fflush (stdout);
   fprintf (stderr, "%s:", pt);
   for (j = 0; j < m->count; j++)
     fprintf (stderr, " %s", m->sections [j]->name);
   putc ('\n',stderr);
+  fflush (stderr);
 }
 
 static bfd_boolean
Index: bfd/elf32-bfin.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-bfin.c,v
retrieving revision 1.51
diff -u -p -r1.51 elf32-bfin.c
--- bfd/elf32-bfin.c	15 Nov 2010 22:30:45 -0000	1.51
+++ bfd/elf32-bfin.c	14 Jan 2011 06:57:45 -0000
@@ -104,7 +104,7 @@ bfin_pcrel24_reloc (bfd *abfd,
   /* if rightshift is 1 and the number odd, return error.  */
   if (howto->rightshift && (relocation & 0x01))
     {
-      fprintf(stderr, "relocation should be even number\n");
+      (*_bfd_error_handler) (_("relocation should be even number"));
       return bfd_reloc_overflow;
     }
 
@@ -360,7 +360,7 @@ bfin_bfd_reloc (bfd *abfd,
   /* If rightshift is 1 and the number odd, return error.  */
   if (howto->rightshift && (relocation & 0x01))
     {
-      fprintf(stderr, "relocation should be even number\n");
+      (*_bfd_error_handler) (_("relocation should be even number"));
       return bfd_reloc_overflow;
     }
 
@@ -5276,7 +5276,8 @@ bfin_finish_dynamic_symbol (bfd * output
 	  && (info->symbolic
 	      || h->dynindx == -1 || h->forced_local) && h->def_regular)
 	{
-	  fprintf(stderr, "*** check this relocation %s\n", __FUNCTION__);
+	  (*_bfd_error_handler) (_("*** check this relocation %s"),
+				 __FUNCTION__);
 	  rela.r_info = ELF32_R_INFO (0, R_BFIN_PCREL24);
 	  rela.r_addend = bfd_get_signed_32 (output_bfd,
 					     (sgot->contents
Index: bfd/elf32-dlx.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-dlx.c,v
retrieving revision 1.23
diff -u -p -r1.23 elf32-dlx.c
--- bfd/elf32-dlx.c	2 Sep 2009 07:18:36 -0000	1.23
+++ bfd/elf32-dlx.c	14 Jan 2011 06:57:45 -0000
@@ -139,9 +139,8 @@ elf32_dlx_relocate16 (bfd *abfd,
   /* Can not support a long jump to sections other then .text.  */
   if (strcmp (input_section->name, symbol->section->output_section->name) != 0)
     {
-      fprintf (stderr,
-	       "BFD Link Error: branch (PC rel16) to section (%s) not supported\n",
-	       symbol->section->output_section->name);
+      (*_bfd_error_handler) (_("BFD Link Error: branch (PC rel16) to section (%s) not supported"),
+			     symbol->section->output_section->name);
       return bfd_reloc_undefined;
     }
 
@@ -202,9 +201,8 @@ elf32_dlx_relocate26 (bfd *abfd,
   /* Can not support a long jump to sections other then .text   */
   if (strcmp (input_section->name, symbol->section->output_section->name) != 0)
     {
-      fprintf (stderr,
-	       "BFD Link Error: jump (PC rel26) to section (%s) not supported\n",
-	       symbol->section->output_section->name);
+      (*_bfd_error_handler) (_("BFD Link Error: jump (PC rel26) to section (%s) not supported"),
+			     symbol->section->output_section->name);
       return bfd_reloc_undefined;
     }
 
Index: bfd/elf32-mep.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mep.c,v
retrieving revision 1.14
diff -u -p -r1.14 elf32-mep.c
--- bfd/elf32-mep.c	25 Oct 2010 15:54:14 -0000	1.14
+++ bfd/elf32-mep.c	14 Jan 2011 06:57:48 -0000
@@ -154,13 +154,14 @@ mep_reloc_type_lookup
 
     default:
       /* Pacify gcc -Wall.  */
-      fprintf (stderr, "mep: no reloc for code %d\n", code);
+      (*_bfd_error_handler) (_("mep: no reloc for code %d"), code);
       return NULL;
     }
 
   if (mep_elf_howto_table[type].type != type)
     {
-      fprintf (stderr, "MeP: howto %d has type %d\n", type, mep_elf_howto_table[type].type);
+      (*_bfd_error_handler) (_("MeP: howto %d has type %d"),
+			     type, mep_elf_howto_table[type].type);
       abort ();
     }
 
Index: bfd/elf32-v850.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-v850.c,v
retrieving revision 1.80
diff -u -p -r1.80 elf32-v850.c
--- bfd/elf32-v850.c	25 Oct 2010 15:54:14 -0000	1.80
+++ bfd/elf32-v850.c	14 Jan 2011 06:57:53 -0000
@@ -480,7 +480,7 @@ v850_elf_perform_lo16_relocation (bfd *a
 	}
       else
 	{
-	  fprintf (stderr, _("FAILED to find previous HI16 reloc\n"));
+	  (*_bfd_error_handler) (_("FAILED to find previous HI16 reloc"));
 	  return FALSE;
 	}
     }
Index: bfd/libbfd.c
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.c,v
retrieving revision 1.53
diff -u -p -r1.53 libbfd.c
--- bfd/libbfd.c	29 Oct 2010 12:10:24 -0000	1.53
+++ bfd/libbfd.c	14 Jan 2011 06:58:04 -0000
@@ -1021,6 +1021,7 @@ warn_deprecated (const char *what,
 
   if (~(size_t) func & ~mask)
     {
+      fflush (stdout);
       /* Note: separate sentences in order to allow
 	 for translation into other languages.  */
       if (func)
@@ -1028,6 +1029,7 @@ warn_deprecated (const char *what,
 		 what, file, line, func);
       else
 	fprintf (stderr, _("Deprecated %s called\n"), what);
+      fflush (stderr);
       mask |= ~(size_t) func;
     }
 }
Index: bfd/mach-o.c
===================================================================
RCS file: /cvs/src/src/bfd/mach-o.c,v
retrieving revision 1.56
diff -u -p -r1.56 mach-o.c
--- bfd/mach-o.c	27 Jun 2010 04:07:53 -0000	1.56
+++ bfd/mach-o.c	14 Jan 2011 06:58:06 -0000
@@ -378,8 +378,7 @@ bfd_mach_o_canonicalize_symtab (bfd *abf
 
   if (bfd_mach_o_read_symtab_symbols (abfd) != 0)
     {
-      fprintf (stderr,
-               "bfd_mach_o_canonicalize_symtab: unable to load symbols\n");
+      (*_bfd_error_handler) (_("bfd_mach_o_canonicalize_symtab: unable to load symbols"));
       return 0;
     }
 
@@ -1251,9 +1250,8 @@ bfd_mach_o_write_contents (bfd *abfd)
 	case BFD_MACH_O_LC_SUB_FRAMEWORK:
 	  break;
 	default:
-	  fprintf (stderr,
-		   "unable to write unknown load command 0x%lx\n",
-		   (unsigned long) cur->type);
+	  (*_bfd_error_handler) (_("unable to write unknown load command 0x%lx"),
+				 (unsigned long) cur->type);
 	  return FALSE;
 	}
     }
@@ -1653,8 +1651,8 @@ bfd_mach_o_read_symtab_symbol (bfd *abfd
   if (bfd_seek (abfd, symoff, SEEK_SET) != 0
       || bfd_bread ((void *) buf, symwidth, abfd) != symwidth)
     {
-      fprintf (stderr, "bfd_mach_o_read_symtab_symbol: unable to read %d bytes at %lu\n",
-	       symwidth, (unsigned long) symoff);
+      (*_bfd_error_handler) (_("bfd_mach_o_read_symtab_symbol: unable to read %d bytes at %lu"),
+			     symwidth, (unsigned long) symoff);
       return -1;
     }
 
@@ -1670,8 +1668,9 @@ bfd_mach_o_read_symtab_symbol (bfd *abfd
 
   if (stroff >= sym->strsize)
     {
-      fprintf (stderr, "bfd_mach_o_read_symtab_symbol: symbol name out of range (%lu >= %lu)\n",
-	       (unsigned long) stroff, (unsigned long) sym->strsize);
+      (*_bfd_error_handler) (_("bfd_mach_o_read_symtab_symbol: symbol name out of range (%lu >= %lu)"),
+			     (unsigned long) stroff,
+			     (unsigned long) sym->strsize);
       return -1;
     }
 
@@ -1754,23 +1753,23 @@ bfd_mach_o_read_symtab_symbol (bfd *abfd
 	      /* Mach-O uses 0 to mean "no section"; not an error.  */
 	      if (section != 0)
 		{
-		  fprintf (stderr, "bfd_mach_o_read_symtab_symbol: "
-			   "symbol \"%s\" specified invalid section %d (max %lu): setting to undefined\n",
-			   s->symbol.name, section, mdata->nsects);
+		  (*_bfd_error_handler) (_("bfd_mach_o_read_symtab_symbol: "
+					   "symbol \"%s\" specified invalid section %d (max %lu): setting to undefined"),
+					 s->symbol.name, section, mdata->nsects);
 		}
 	      s->symbol.section = bfd_und_section_ptr;
 	    }
 	  break;
 	case BFD_MACH_O_N_INDR:
-	  fprintf (stderr, "bfd_mach_o_read_symtab_symbol: "
-		   "symbol \"%s\" is unsupported 'indirect' reference: setting to undefined\n",
-		   s->symbol.name);
+	  (*_bfd_error_handler) (_("bfd_mach_o_read_symtab_symbol: "
+				   "symbol \"%s\" is unsupported 'indirect' reference: setting to undefined"),
+				 s->symbol.name);
 	  s->symbol.section = bfd_und_section_ptr;
 	  break;
 	default:
-	  fprintf (stderr, "bfd_mach_o_read_symtab_symbol: "
-		   "symbol \"%s\" specified invalid type field 0x%x: setting to undefined\n",
-		   s->symbol.name, symtype);
+	  (*_bfd_error_handler) (_("bfd_mach_o_read_symtab_symbol: "
+				   "symbol \"%s\" specified invalid type field 0x%x: setting to undefined"),
+				 s->symbol.name, symtype);
 	  s->symbol.section = bfd_und_section_ptr;
 	  break;
 	}
@@ -1838,7 +1837,7 @@ bfd_mach_o_read_symtab_symbols (bfd *abf
 
   if (sym->symbols == NULL)
     {
-      fprintf (stderr, "bfd_mach_o_read_symtab_symbols: unable to allocate memory for symbols\n");
+      (*_bfd_error_handler) (_("bfd_mach_o_read_symtab_symbols: unable to allocate memory for symbols"));
       return -1;
     }
 
@@ -1872,8 +1871,8 @@ bfd_mach_o_read_dysymtab_symbol (bfd *ab
   if (bfd_seek (abfd, isymoff, SEEK_SET) != 0
       || bfd_bread ((void *) buf, 4, abfd) != 4)
     {
-      fprintf (stderr, "bfd_mach_o_read_dysymtab_symbol: unable to read %lu bytes at %lu\n",
-	       (unsigned long) 4, isymoff);
+      (*_bfd_error_handler) (_("bfd_mach_o_read_dysymtab_symbol: unable to read %lu bytes at %lu"),
+			       (unsigned long) 4, isymoff);
       return -1;
     }
   sym_index = bfd_h_get_32 (abfd, buf);
@@ -2554,8 +2553,8 @@ bfd_mach_o_read_command (bfd *abfd, bfd_
 	return -1;
       break;
     default:
-      fprintf (stderr, "unable to read unknown load command 0x%lx\n",
-	       (unsigned long) command->type);
+      (*_bfd_error_handler) (_("unable to read unknown load command 0x%lx"),
+			     (unsigned long) command->type);
       break;
     }
 
@@ -2734,8 +2733,8 @@ bfd_mach_o_scan (bfd *abfd,
 				   &cputype, &cpusubtype);
   if (cputype == bfd_arch_unknown)
     {
-      fprintf (stderr, "bfd_mach_o_scan: unknown architecture 0x%lx/0x%lx\n",
-	       header->cputype, header->cpusubtype);
+      (*_bfd_error_handler) (_("bfd_mach_o_scan: unknown architecture 0x%lx/0x%lx"),
+			     header->cputype, header->cpusubtype);
       return -1;
     }
 
@@ -2830,8 +2829,8 @@ bfd_mach_o_header_p (bfd *abfd,
   if (! (header.byteorder == BFD_ENDIAN_BIG
 	 || header.byteorder == BFD_ENDIAN_LITTLE))
     {
-      fprintf (stderr, "unknown header byte-order value 0x%lx\n",
-	       (unsigned long) header.byteorder);
+      (*_bfd_error_handler) (_("unknown header byte-order value 0x%lx"),
+			     (unsigned long) header.byteorder);
       goto wrong;
     }
 
Index: bfd/pef.c
===================================================================
RCS file: /cvs/src/src/bfd/pef.c,v
retrieving revision 1.30
diff -u -p -r1.30 pef.c
--- bfd/pef.c	11 Dec 2009 13:42:04 -0000	1.30
+++ bfd/pef.c	14 Jan 2011 06:58:06 -0000
@@ -516,8 +516,8 @@ bfd_pef_scan (abfd, header, mdata)
   bfd_pef_convert_architecture (header->architecture, &cputype, &cpusubtype);
   if (cputype == bfd_arch_unknown)
     {
-      fprintf (stderr, "bfd_pef_scan: unknown architecture 0x%lx\n",
-	       header->architecture);
+      (*_bfd_error_handler) (_("bfd_pef_scan: unknown architecture 0x%lx"),
+			       header->architecture);
       return -1;
     }
   bfd_set_arch_mach (abfd, cputype, cpusubtype);
Index: bfd/som.c
===================================================================
RCS file: /cvs/src/src/bfd/som.c,v
retrieving revision 1.82
diff -u -p -r1.82 som.c
--- bfd/som.c	27 Jun 2010 04:07:53 -0000	1.82
+++ bfd/som.c	14 Jan 2011 06:58:09 -0000
@@ -5774,7 +5774,6 @@ som_sizeof_headers (bfd *abfd ATTRIBUTE_
 		    struct bfd_link_info *info ATTRIBUTE_UNUSED)
 {
   (*_bfd_error_handler) (_("som_sizeof_headers unimplemented"));
-  fflush (stderr);
   abort ();
   return 0;
 }
Index: ld/ldmain.c
===================================================================
RCS file: /cvs/src/src/ld/ldmain.c,v
retrieving revision 1.147
diff -u -p -r1.147 ldmain.c
--- ld/ldmain.c	6 Dec 2010 12:44:51 -0000	1.147
+++ ld/ldmain.c	14 Jan 2011 06:58:45 -0000
@@ -551,12 +551,14 @@ main (int argc, char **argv)
 #endif
       long run_time = get_run_time () - start_time;
 
+      fflush (stdout);
       fprintf (stderr, _("%s: total time in link: %ld.%06ld\n"),
 	       program_name, run_time / 1000000, run_time % 1000000);
 #ifdef HAVE_SBRK
       fprintf (stderr, _("%s: data size %ld\n"), program_name,
 	       (long) (lim - (char *) &environ));
 #endif
+      fflush (stderr);
     }
 
   /* Prevent remove_output from doing anything, after a successful link.  */
Index: ld/ldmisc.c
===================================================================
RCS file: /cvs/src/src/ld/ldmisc.c,v
retrieving revision 1.37
diff -u -p -r1.37 ldmisc.c
--- ld/ldmisc.c	14 Oct 2010 01:31:31 -0000	1.37
+++ ld/ldmisc.c	14 Jan 2011 06:58:45 -0000
@@ -440,9 +440,11 @@ einfo (const char *fmt, ...)
 {
   va_list arg;
 
+  fflush (stdout);
   va_start (arg, fmt);
   vfinfo (stderr, fmt, arg, TRUE);
   va_end (arg);
+  fflush (stderr);
 }
 
 void
Index: ld/plugin.c
===================================================================
RCS file: /cvs/src/src/ld/plugin.c,v
retrieving revision 1.20
diff -u -p -r1.20 plugin.c
--- ld/plugin.c	5 Jan 2011 14:25:26 -0000	1.20
+++ ld/plugin.c	14 Jan 2011 06:58:46 -0000
@@ -596,7 +596,9 @@ message (int level, const char *format, 
 	  char *newfmt = ACONCAT ((level == LDPL_FATAL
 				   ? "%P%F: " : "%P%X: ",
 				   format, "\n", NULL));
+	  fflush (stdout);
 	  vfinfo (stderr, newfmt, args, TRUE);
+	  fflush (stderr);
 	}
       break;
     }
Index: ld/emulparams/elf32mcore.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32mcore.sh,v
retrieving revision 1.17
diff -u -p -r1.17 elf32mcore.sh
--- ld/emulparams/elf32mcore.sh	22 Oct 2008 05:20:44 -0000	1.17
+++ ld/emulparams/elf32mcore.sh	14 Jan 2011 06:58:46 -0000
@@ -49,11 +49,6 @@ PARSE_AND_LIST_ARGS_CASES='
     case OPTION_BASE_FILE:
       link_info.base_file = fopen (optarg, FOPEN_WB);
       if (link_info.base_file == NULL)
-	{
-	  /* xgettext:c-format */
-	  fprintf (stderr, _("%s: Cannot open base file %s\n"),
-		   program_name, optarg);
-	  xexit (1);
-	}
+	einfo (_("%F%P: cannot open base file %s\n"), optarg);
       break;
 '
Index: ld/emultempl/beos.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/beos.em,v
retrieving revision 1.46
diff -u -p -r1.46 beos.em
--- ld/emultempl/beos.em	13 Jan 2011 13:06:22 -0000	1.46
+++ ld/emultempl/beos.em	14 Jan 2011 06:58:46 -0000
@@ -270,11 +270,7 @@ gld${EMULATION_NAME}_handle_option (int 
     case OPTION_BASE_FILE:
       link_info.base_file = fopen (optarg, FOPEN_WB);
       if (link_info.base_file == NULL)
-	{
-	  fprintf (stderr, "%s: Can't open base file %s\n",
-		   program_name, optarg);
-	  xexit (1);
-	}
+	einfo (_("%F%P: cannot open base file %s\n"), optarg);
       break;
 
       /* PE options */
Index: ld/emultempl/pe.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pe.em,v
retrieving revision 1.166
diff -u -p -r1.166 pe.em
--- ld/emultempl/pe.em	13 Jan 2011 13:06:22 -0000	1.166
+++ ld/emultempl/pe.em	14 Jan 2011 06:58:48 -0000
@@ -688,12 +688,7 @@ gld${EMULATION_NAME}_handle_option (int 
     case OPTION_BASE_FILE:
       link_info.base_file = fopen (optarg, FOPEN_WB);
       if (link_info.base_file == NULL)
-	{
-	  /* xgettext:c-format */
-	  fprintf (stderr, _("%s: Can't open base file %s\n"),
-		   program_name, optarg);
-	  xexit (1);
-	}
+	einfo (_("%F%P: cannot open base file %s\n"), optarg);
       break;
 
       /* PE options.  */
Index: ld/emultempl/pep.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pep.em,v
retrieving revision 1.42
diff -u -p -r1.42 pep.em
--- ld/emultempl/pep.em	13 Jan 2011 13:06:22 -0000	1.42
+++ ld/emultempl/pep.em	14 Jan 2011 06:58:49 -0000
@@ -611,12 +611,7 @@ gld${EMULATION_NAME}_handle_option (int 
     case OPTION_BASE_FILE:
       link_info.base_file = fopen (optarg, FOPEN_WB);
       if (link_info.base_file == NULL)
-	{
-	  /* xgettext:c-format */
-	  fprintf (stderr, _("%s: Can't open base file %s\n"),
-		   program_name, optarg);
-	  xexit (1);
-	}
+	einfo (_("%F%P: cannot open base file %s\n"), optarg);
       break;
 
       /* PE options.  */
Index: ld/emultempl/ppc64elf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/ppc64elf.em,v
retrieving revision 1.72
diff -u -p -r1.72 ppc64elf.em
--- ld/emultempl/ppc64elf.em	28 Oct 2010 08:38:45 -0000	1.72
+++ ld/emultempl/ppc64elf.em	14 Jan 2011 12:08:33 -0000
@@ -545,6 +545,7 @@ gld${EMULATION_NAME}_finish (void)
 				  config.stats ? &msg : NULL))
 	einfo ("%X%P: can not build stubs: %E\n");
 
+      fflush (stdout);
       for (line = msg; line != NULL; line = endline)
 	{
 	  endline = strchr (line, '\n');
@@ -552,6 +553,7 @@ gld${EMULATION_NAME}_finish (void)
 	    *endline++ = '\0';
 	  fprintf (stderr, "%s: %s\n", program_name, line);
 	}
+      fflush (stderr);
       if (msg != NULL)
 	free (msg);
     }
Index: ld/emultempl/xtensaelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/xtensaelf.em,v
retrieving revision 1.28
diff -u -p -r1.28 xtensaelf.em
--- ld/emultempl/xtensaelf.em	13 Jan 2011 13:06:22 -0000	1.28
+++ ld/emultempl/xtensaelf.em	14 Jan 2011 12:08:33 -0000
@@ -1817,8 +1817,10 @@ ld_local_file_relocations_fit (lang_stat
 		  bfd_vma target_addr = e->tgt->output_offset & ~3;
 		  if (l32r_addr < target_addr)
 		    {
+		      fflush (stdout);
 		      fprintf (stderr, "Warning: "
 			       "l32r target section before l32r\n");
+		      fflush (stderr);
 		      return FALSE;
 		    }
 

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]