#define DEBUG_TYPE "toolrunner"
#include "llvm/Support/ToolRunner.h"
+#include "Config/config.h" // for HAVE_LINK_R
#include "Support/Debug.h"
#include "Support/FileUtilities.h"
#include <iostream>
#include <fstream>
+using namespace llvm;
//===---------------------------------------------------------------------===//
// LLI Implementation of AbstractIntepreter interface
//
-class LLI : public AbstractInterpreter {
- std::string LLIPath; // The path to the LLI executable
-public:
- LLI(const std::string &Path) : LLIPath(Path) { }
-
-
- virtual int ExecuteProgram(const std::string &Bytecode,
- const std::vector<std::string> &Args,
- const std::string &InputFile,
- const std::string &OutputFile,
- const std::vector<std::string> &SharedLibs =
+namespace {
+ class LLI : public AbstractInterpreter {
+ std::string LLIPath; // The path to the LLI executable
+ public:
+ LLI(const std::string &Path) : LLIPath(Path) { }
+
+
+ virtual int ExecuteProgram(const std::string &Bytecode,
+ const std::vector<std::string> &Args,
+ const std::string &InputFile,
+ const std::string &OutputFile,
+ const std::vector<std::string> &SharedLibs =
std::vector<std::string>());
-};
+ };
+}
int LLI::ExecuteProgram(const std::string &Bytecode,
const std::vector<std::string> &Args,
//===---------------------------------------------------------------------===//
// JIT Implementation of AbstractIntepreter interface
//
-class JIT : public AbstractInterpreter {
- std::string LLIPath; // The path to the LLI executable
-public:
- JIT(const std::string &Path) : LLIPath(Path) { }
-
-
- virtual int ExecuteProgram(const std::string &Bytecode,
- const std::vector<std::string> &Args,
- const std::string &InputFile,
- const std::string &OutputFile,
- const std::vector<std::string> &SharedLibs =
+namespace {
+ class JIT : public AbstractInterpreter {
+ std::string LLIPath; // The path to the LLI executable
+ public:
+ JIT(const std::string &Path) : LLIPath(Path) { }
+
+
+ virtual int ExecuteProgram(const std::string &Bytecode,
+ const std::vector<std::string> &Args,
+ const std::string &InputFile,
+ const std::string &OutputFile,
+ const std::vector<std::string> &SharedLibs =
std::vector<std::string>());
-};
+ };
+}
int JIT::ExecuteProgram(const std::string &Bytecode,
const std::vector<std::string> &Args,
GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file...
GCCArgs.push_back("-lm"); // Hard-code the math library...
GCCArgs.push_back("-O2"); // Optimize the program a bit...
+#if defined (HAVE_LINK_R)
GCCArgs.push_back("-Wl,-R."); // Search this dir for .so files
+#endif
GCCArgs.push_back(0); // NULL terminator
std::cout << "<gcc>" << std::flush;