For PR797:
Adjust usage of the ExecuteAndWait function to use the last argument which
is the ErrMsg string. This is necessitated because this function no longer
throws exceptions on error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29791 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp
index 22a26ef..a9df06d 100644
--- a/tools/gccld/gccld.cpp
+++ b/tools/gccld/gccld.cpp
@@ -320,12 +320,19 @@
 
       // Generate an assembly language file for the bytecode.
       if (Verbose) std::cout << "Generating Assembly Code\n";
-      GenerateAssembly(AssemblyFile.toString(), RealBytecodeOutput, llc,
-                       Verbose);
+      std::string ErrMsg;
+      if (0 != GenerateAssembly(
+          AssemblyFile.toString(), RealBytecodeOutput, llc, ErrMsg, Verbose)) {
+        std::cerr << argv[0] << ": " << ErrMsg << "\n";
+        return 2;
+      }
       if (Verbose) std::cout << "Generating Native Code\n";
-      GenerateNative(OutputFilename, AssemblyFile.toString(),
+      if (0 != GenerateNative(OutputFilename, AssemblyFile.toString(),
                      LibPaths, Libraries, gcc, envp, LinkAsLibrary,
-                     NoInternalize, RPath, SOName, Verbose);
+                     NoInternalize, RPath, SOName, ErrMsg, Verbose) ) {
+        std::cerr << argv[0] << ": " << ErrMsg << "\n";
+        return 2;
+      }
 
       if (!SaveTemps) {
         // Remove the assembly language file.
@@ -353,11 +360,19 @@
 
       // Generate an assembly language file for the bytecode.
       if (Verbose) std::cout << "Generating C Source Code\n";
-      GenerateCFile(CFile.toString(), RealBytecodeOutput, llc, Verbose);
+      std::string ErrMsg;
+      if (0 != GenerateCFile(
+          CFile.toString(), RealBytecodeOutput, llc, ErrMsg, Verbose)) {
+        std::cerr << argv[0] << ": " << ErrMsg << "\n";
+        return 2;
+      }
       if (Verbose) std::cout << "Generating Native Code\n";
-      GenerateNative(OutputFilename, CFile.toString(),
+      if (0 != GenerateNative(OutputFilename, CFile.toString(),
                      LibPaths, Libraries, gcc, envp, LinkAsLibrary,
-                     NoInternalize, RPath, SOName, Verbose);
+                     NoInternalize, RPath, SOName, ErrMsg, Verbose)) {
+        std::cerr << argv[0] << ": " << ErrMsg << "\n";
+        return 2;
+      }
 
       if (!SaveTemps) {
         // Remove the assembly language file.