Changes in directory llvm/tools/llvm-ld:
llvm-ld.cpp updated: 1.33 -> 1.34 --- Log message: For PR797: http://llvm.org/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. --- Diffs of the changes: (+39 -12) llvm-ld.cpp | 51 +++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 39 insertions(+), 12 deletions(-) Index: llvm/tools/llvm-ld/llvm-ld.cpp diff -u llvm/tools/llvm-ld/llvm-ld.cpp:1.33 llvm/tools/llvm-ld/llvm-ld.cpp:1.34 --- llvm/tools/llvm-ld/llvm-ld.cpp:1.33 Tue Jun 27 13:07:29 2006 +++ llvm/tools/llvm-ld/llvm-ld.cpp Mon Aug 21 01:04:45 2006 @@ -227,7 +227,8 @@ /// static int GenerateAssembly(const std::string &OutputFilename, const std::string &InputFilename, - const sys::Path &llc) { + const sys::Path &llc, + std::string &ErrMsg ) { // Run LLC to convert the bytecode file into assembly code. std::vector<const char*> args; args.push_back(llc.c_str()); @@ -237,13 +238,14 @@ args.push_back(InputFilename.c_str()); args.push_back(0); - return sys::Program::ExecuteAndWait(llc,&args[0]); + return sys::Program::ExecuteAndWait(llc,&args[0],0,0,0,&ErrMsg); } /// GenerateCFile - generates a C source file from the specified bytecode file. static int GenerateCFile(const std::string &OutputFile, const std::string &InputFile, - const sys::Path &llc) { + const sys::Path &llc, + std::string& ErrMsg) { // Run LLC to convert the bytecode file into C. std::vector<const char*> args; args.push_back(llc.c_str()); @@ -253,7 +255,7 @@ args.push_back(OutputFile.c_str()); args.push_back(InputFile.c_str()); args.push_back(0); - return sys::Program::ExecuteAndWait(llc, &args[0]); + return sys::Program::ExecuteAndWait(llc, &args[0],0,0,0,&ErrMsg); } /// GenerateNative - generates a native object file from the @@ -275,7 +277,8 @@ static int GenerateNative(const std::string &OutputFilename, const std::string &InputFilename, const std::vector<std::string> &Libraries, - const sys::Path &gcc, char ** const envp) { + const sys::Path &gcc, char ** const envp, + std::string& ErrMsg) { // Remove these environment variables from the environment of the // programs that we will execute. It appears that GCC sets these // environment variables so that the programs it uses can configure @@ -329,7 +332,8 @@ args.push_back(0); // Run the compiler to assembly and link together the program. - int R = sys::Program::ExecuteAndWait(gcc, &args[0], (const char**)clean_env); + int R = sys::Program::ExecuteAndWait( + gcc, &args[0], (const char**)clean_env,0,0,&ErrMsg); delete [] clean_env; return R; } @@ -497,7 +501,8 @@ args[1] = RealBytecodeOutput.c_str(); args[2] = tmp_output.c_str(); args[3] = 0; - if (0 == sys::Program::ExecuteAndWait(prog, args)) { + std::string ErrMsg; + if (0 == sys::Program::ExecuteAndWait(prog, args, 0,0,0, &ErrMsg)) { if (tmp_output.isBytecodeFile()) { sys::Path target(RealBytecodeOutput); target.eraseFromDisk(); @@ -505,6 +510,9 @@ } else return PrintAndReturn( "Post-link optimization output is not bytecode"); + } else { + std::cerr << argv[0] << ": " << ErrMsg << "\n"; + return 2; } } } @@ -533,10 +541,19 @@ // Generate an assembly language file for the bytecode. if (Verbose) std::cout << "Generating Assembly Code\n"; - GenerateAssembly(AssemblyFile.toString(), RealBytecodeOutput, llc); + std::string ErrMsg; + if (0 != GenerateAssembly(AssemblyFile.toString(), RealBytecodeOutput, + llc, ErrMsg)) { + std::cerr << argv[0] << ": " << ErrMsg << "\n"; + return 1; + } + if (Verbose) std::cout << "Generating Native Code\n"; - GenerateNative(OutputFilename, AssemblyFile.toString(), Libraries, - gcc, envp); + if (0 != GenerateNative(OutputFilename, AssemblyFile.toString(), + Libraries,gcc,envp,ErrMsg)) { + std::cerr << argv[0] << ": " << ErrMsg << "\n"; + return 1; + } // Remove the assembly language file. AssemblyFile.eraseFromDisk(); @@ -559,9 +576,19 @@ // Generate an assembly language file for the bytecode. if (Verbose) std::cout << "Generating Assembly Code\n"; - GenerateCFile(CFile.toString(), RealBytecodeOutput, llc); + std::string ErrMsg; + if (0 != GenerateCFile( + CFile.toString(), RealBytecodeOutput, llc, ErrMsg)) { + std::cerr << argv[0] << ": " << ErrMsg << "\n"; + return 1; + } + if (Verbose) std::cout << "Generating Native Code\n"; - GenerateNative(OutputFilename, CFile.toString(), Libraries, gcc, envp); + if (0 != GenerateNative(OutputFilename, CFile.toString(), Libraries, + gcc, envp, ErrMsg)) { + std::cerr << argv[0] << ": " << ErrMsg << "\n"; + return 1; + } // Remove the assembly language file. CFile.eraseFromDisk(); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits