#include "llvm/LinkAllVMCore.h"
#include "llvm/Linker.h"
#include "llvm/LLVMContext.h"
-#include "llvm/System/Program.h"
+#include "llvm/Support/Program.h"
#include "llvm/Module.h"
#include "llvm/PassManager.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/SystemUtils.h"
#include "llvm/Support/ToolOutputFile.h"
-#include "llvm/System/Signals.h"
+#include "llvm/Support/Signals.h"
#include "llvm/Config/config.h"
#include <memory>
#include <cstring>
// Allocate a new environment list.
char **newenv = new char* [entries];
- if ((newenv = new char* [entries]) == NULL)
+ if (newenv == NULL)
return NULL;
// Make a copy of the list. Don't forget the NULL that ends the list.
static void EmitShellScript(char **argv, Module *M) {
if (Verbose)
errs() << "Emitting Shell Script\n";
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
// Windows doesn't support #!/bin/sh style shell scripts in .exe files. To
// support windows systems, we copy the llvm-stub.exe executable from the
// build tree to the destination file.
std::string ErrMsg;
- sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0],
- (void *)(intptr_t)&Optimize);
+ sys::Path llvmstub = PrependMainExecutablePath("llvm-stub", argv[0],
+ (void *)(intptr_t)&Optimize);
if (llvmstub.isEmpty())
PrintAndExit("Could not find llvm-stub.exe executable!", M);
E = LibPaths.end(); P != E; ++P) {
FullLibraryPath = *P;
FullLibraryPath.appendComponent("lib" + *i);
- FullLibraryPath.appendSuffix(&(LTDL_SHLIB_EXT[1]));
+ FullLibraryPath.appendSuffix(sys::Path::GetDLLSuffix());
if (!FullLibraryPath.isEmpty()) {
if (!FullLibraryPath.isDynamicLibrary()) {
// Not a native shared library; mark as invalid
initializeTarget(Registry);
// Initial global variable above for convenience printing of program name.
- progname = sys::Path(argv[0]).getBasename();
+ progname = sys::path::stem(argv[0]);
// Parse the command line options
cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
OutputFilename = "a.exe";
// If there is no suffix add an "exe" one.
- sys::Path ExeFile( OutputFilename );
- if (ExeFile.getSuffix() == "") {
- ExeFile.appendSuffix("exe");
- OutputFilename = ExeFile.str();
- }
+ if (sys::path::extension(OutputFilename).empty())
+ OutputFilename.append(".exe");
}
#endif
}
// Arrange for the bitcode output file to be deleted on any errors.
- BitcodeOutputRemover.setFile(sys::Path(BitcodeOutputFilename));
+ BitcodeOutputRemover.setFile(BitcodeOutputFilename);
sys::RemoveFileOnSignal(sys::Path(BitcodeOutputFilename));
// Arrange for the output file to be deleted on any errors.
if (!LinkAsLibrary) {
- OutputRemover.setFile(sys::Path(OutputFilename));
+ OutputRemover.setFile(OutputFilename);
sys::RemoveFileOnSignal(sys::Path(OutputFilename));
}
AssemblyFile.appendSuffix("s");
// Mark the output files for removal.
- FileRemover AssemblyFileRemover(AssemblyFile);
+ FileRemover AssemblyFileRemover(AssemblyFile.str());
sys::RemoveFileOnSignal(AssemblyFile);
// Determine the locations of the llc and gcc programs.
- sys::Path llc = FindExecutable("llc", argv[0],
- (void *)(intptr_t)&Optimize);
+ sys::Path llc = PrependMainExecutablePath("llc", argv[0],
+ (void *)(intptr_t)&Optimize);
if (llc.isEmpty())
PrintAndExit("Failed to find llc", Composite.get());
CFile.appendSuffix("cbe.c");
// Mark the output files for removal.
- FileRemover CFileRemover(CFile);
+ FileRemover CFileRemover(CFile.str());
sys::RemoveFileOnSignal(CFile);
// Determine the locations of the llc and gcc programs.
- sys::Path llc = FindExecutable("llc", argv[0],
- (void *)(intptr_t)&Optimize);
+ sys::Path llc = PrependMainExecutablePath("llc", argv[0],
+ (void *)(intptr_t)&Optimize);
if (llc.isEmpty())
PrintAndExit("Failed to find llc", Composite.get());