re PR target/65697 (__atomic memory barriers not strong enough for __sync builtins)
[gcc.git] / gcc / collect-utils.c
index febc5192d1460df46bc4fed9be5e6b3b4c05efe8..517a0757590d2a7035ccf6d9d116ce4050147ea9 100644 (file)
@@ -1,5 +1,5 @@
 /* Utility functions used by tools like collect2 and lto-wrapper.
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -65,15 +65,21 @@ collect_wait (const char *prog, struct pex_obj *pex)
   int status;
 
   if (!pex_get_status (pex, 1, &status))
-    fatal_error ("can't get program status: %m");
+    fatal_error (input_location, "can't get program status: %m");
   pex_free (pex);
 
+  if (response_file && !save_temps)
+    {
+      unlink (response_file);
+      response_file = NULL;
+    }
+
   if (status)
     {
       if (WIFSIGNALED (status))
        {
          int sig = WTERMSIG (status);
-         fatal_error ("%s terminated with signal %d [%s]%s",
+         fatal_error (input_location, "%s terminated with signal %d [%s]%s",
                       prog, sig, strsignal (sig),
                       WCOREDUMP (status) ? ", core dumped" : "");
        }
@@ -89,13 +95,7 @@ do_wait (const char *prog, struct pex_obj *pex)
 {
   int ret = collect_wait (prog, pex);
   if (ret != 0)
-    fatal_error ("%s returned %d exit status", prog, ret);
-
-  if (response_file && !save_temps)
-    {
-      unlink (response_file);
-      response_file = NULL;
-    }
+    fatal_error (input_location, "%s returned %d exit status", prog, ret);
 }
 
 \f
@@ -130,17 +130,20 @@ collect_execute (const char *prog, char **argv, const char *outname,
       f = fopen (response_file, "w");
 
       if (f == NULL)
-        fatal_error ("could not open response file %s", response_file);
+        fatal_error (input_location, "could not open response file %s",
+                    response_file);
 
       status = writeargv (current_argv, f);
 
       if (status)
-        fatal_error ("could not write to response file %s", response_file);
+        fatal_error (input_location, "could not write to response file %s",
+                    response_file);
 
       status = fclose (f);
 
       if (EOF == status)
-        fatal_error ("could not close response file %s", response_file);
+        fatal_error (input_location, "could not close response file %s",
+                    response_file);
 
       response_arg = concat ("@", response_file, NULL);
       response_argv[0] = argv0;
@@ -173,11 +176,11 @@ collect_execute (const char *prog, char **argv, const char *outname,
      since we might not end up needing something that we could not find.  */
 
   if (argv[0] == 0)
-    fatal_error ("cannot find '%s'", prog);
+    fatal_error (input_location, "cannot find '%s'", prog);
 
   pex = pex_init (0, "collect2", NULL);
   if (pex == NULL)
-    fatal_error ("pex_init failed: %m");
+    fatal_error (input_location, "pex_init failed: %m");
 
   errmsg = pex_run (pex, flags, argv[0], argv, outname,
                    errname, &err);
@@ -186,10 +189,10 @@ collect_execute (const char *prog, char **argv, const char *outname,
       if (err != 0)
        {
          errno = err;
-         fatal_error ("%s: %m", _(errmsg));
+         fatal_error (input_location, "%s: %m", _(errmsg));
        }
       else
-       fatal_error (errmsg);
+       fatal_error (input_location, errmsg);
     }
 
   free (response_arg);
@@ -221,7 +224,5 @@ utils_cleanup (bool from_signal)
      calls to maybe_unlink fails. */
   cleanup_done = true;
 
-  if (response_file)
-    maybe_unlink (response_file);
   tool_cleanup (from_signal);
 }