diff --git a/lib/Support/ToolRunner.cpp b/lib/Support/ToolRunner.cpp index 50a9ad21c85..0f2e13e20f1 100644 --- a/lib/Support/ToolRunner.cpp +++ b/lib/Support/ToolRunner.cpp @@ -13,6 +13,7 @@ #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 @@ -299,7 +300,9 @@ int GCC::ExecuteProgram(const std::string &ProgramFile, 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 << "" << std::flush; diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp index 50a9ad21c85..0f2e13e20f1 100644 --- a/tools/bugpoint/ToolRunner.cpp +++ b/tools/bugpoint/ToolRunner.cpp @@ -13,6 +13,7 @@ #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 @@ -299,7 +300,9 @@ int GCC::ExecuteProgram(const std::string &ProgramFile, 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 << "" << std::flush;