aboutsummaryrefslogtreecommitdiff
path: root/gold/gold.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-14 06:49:14 +0000
committerIan Lance Taylor <iant@google.com>2007-10-14 06:49:14 +0000
commit75f2446ec3c13eca3fe0c7cfdbb232e760d36596 (patch)
treea243e4c2c79cd8790a316a38b552507b62bf0421 /gold/gold.cc
parenteb4dfdd470e49ab56eed5cead19704e0926530d0 (diff)
downloadgdb-75f2446ec3c13eca3fe0c7cfdbb232e760d36596.zip
gdb-75f2446ec3c13eca3fe0c7cfdbb232e760d36596.tar.gz
gdb-75f2446ec3c13eca3fe0c7cfdbb232e760d36596.tar.bz2
Run all error handling through an Errors object. Delete output file
on error.
Diffstat (limited to 'gold/gold.cc')
-rw-r--r--gold/gold.cc21
1 files changed, 6 insertions, 15 deletions
diff --git a/gold/gold.cc b/gold/gold.cc
index a426408..1396524 100644
--- a/gold/gold.cc
+++ b/gold/gold.cc
@@ -26,6 +26,7 @@
#include <cstdio>
#include <cstring>
#include <unistd.h>
+#include "libiberty.h"
#include "options.h"
#include "workqueue.h"
@@ -46,21 +47,12 @@ const char* program_name;
void
gold_exit(bool status)
{
+ if (!status && parameters != NULL)
+ unlink_if_ordinary(parameters->output_file_name());
exit(status ? EXIT_SUCCESS : EXIT_FAILURE);
}
void
-gold_fatal(const char* msg, bool perrno)
-{
- fprintf(stderr, "%s: ", program_name);
- if (perrno)
- perror(msg);
- else
- fprintf(stderr, "%s\n", msg);
- gold_exit(false);
-}
-
-void
gold_nomem()
{
// We are out of memory, so try hard to print a reasonable message.
@@ -123,7 +115,7 @@ queue_initial_tasks(const General_options& options,
Symbol_table* symtab, Layout* layout)
{
if (cmdline.begin() == cmdline.end())
- gold_fatal(_("no input files"), false);
+ gold_fatal(_("no input files"));
// Read the input files. We have to add the symbols to the symbol
// table in order. We do this by creating a separate blocker for
@@ -166,9 +158,8 @@ queue_middle_tasks(const General_options& options,
if (!doing_static_link && options.is_static())
{
// We print out just the first .so we see; there may be others.
- fprintf(stderr, _("%s: cannot mix -static with dynamic object %s\n"),
- program_name, (*input_objects->dynobj_begin())->name().c_str());
- gold_exit(false);
+ gold_error(_("cannot mix -static with dynamic object %s"),
+ (*input_objects->dynobj_begin())->name().c_str());
}
// Define some sections and symbols needed for a dynamic link. This