summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/gas/output-file.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2010-11-01 19:35:33 +0000
committerdim <dim@FreeBSD.org>2010-11-01 19:35:33 +0000
commit3f5c947f4453c6016a2a6a9636367ee3f48fc6fc (patch)
tree461aafc934d462eb9b9221308f8e25238c0ada62 /contrib/binutils/gas/output-file.c
parente6be3e7867eb43d220575baee2ce5662fb03e46c (diff)
parentd0f678fa0ff3f08a4eca29daf4d1ac39797b6326 (diff)
downloadFreeBSD-src-3f5c947f4453c6016a2a6a9636367ee3f48fc6fc.zip
FreeBSD-src-3f5c947f4453c6016a2a6a9636367ee3f48fc6fc.tar.gz
Merge ^/vendor/binutils/dist@214571 into contrib/binutils, which brings
us up to version 2.17.50.20070703, at the last GPLv2 commit. Amongst others, this added upstream support for some FreeBSD-specific things that we previously had to manually hack in, such as the OSABI label support, and so on. There are also quite a number of new files, some for cpu's (e.g. SPU) that we may or may not be interested in, but those can be cleaned up later on, if needed.
Diffstat (limited to 'contrib/binutils/gas/output-file.c')
-rw-r--r--contrib/binutils/gas/output-file.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/contrib/binutils/gas/output-file.c b/contrib/binutils/gas/output-file.c
index f94359a..9603dc4 100644
--- a/contrib/binutils/gas/output-file.c
+++ b/contrib/binutils/gas/output-file.c
@@ -1,6 +1,6 @@
/* output-file.c - Deal with the output file
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2001,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -19,17 +19,13 @@
the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include <stdio.h>
-
#include "as.h"
-
#include "output-file.h"
#ifndef TARGET_MACH
#define TARGET_MACH 0
#endif
-#include "bfd.h"
bfd *stdoutput;
void
@@ -40,11 +36,12 @@ output_file_create (char *name)
else if (!(stdoutput = bfd_openw (name, TARGET_FORMAT)))
{
- if (bfd_get_error () == bfd_error_invalid_target)
- as_perror (_("Selected target format '%s' unknown"), TARGET_FORMAT);
+ bfd_error_type err = bfd_get_error ();
+
+ if (err == bfd_error_invalid_target)
+ as_fatal (_("selected target format '%s' unknown"), TARGET_FORMAT);
else
- as_perror (_("FATAL: can't create %s"), name);
- exit (EXIT_FAILURE);
+ as_fatal (_("can't create %s: %s"), name, bfd_errmsg (err));
}
bfd_set_format (stdoutput, bfd_object);
@@ -56,12 +53,19 @@ output_file_create (char *name)
void
output_file_close (char *filename)
{
+ bfd_boolean res;
+
+ if (stdoutput == NULL)
+ return;
+
/* Close the bfd. */
- if (bfd_close (stdoutput) == 0)
- {
- bfd_perror (filename);
- as_perror (_("FATAL: can't close %s\n"), filename);
- exit (EXIT_FAILURE);
- }
- stdoutput = NULL; /* Trust nobody! */
+ res = bfd_close (stdoutput);
+
+ /* Prevent an infinite loop - if the close failed we will call as_fatal
+ which will call xexit() which may call this function again... */
+ stdoutput = NULL;
+
+ if (! res)
+ as_fatal (_("can't close %s: %s"), filename,
+ bfd_errmsg (bfd_get_error ()));
}
OpenPOWER on IntegriCloud