Make sure we ONLY add a `-load' switch to the JIT command line if the file is
authorMisha Brukman <brukman+llvm@gmail.com>
Mon, 24 Nov 2003 05:29:42 +0000 (05:29 +0000)
committerMisha Brukman <brukman+llvm@gmail.com>
Mon, 24 Nov 2003 05:29:42 +0000 (05:29 +0000)
verified as having an ELF header. This fixes PR151.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10195 91177308-0d34-0410-b5e6-96231b3b80d8

tools/gccld/gccld.cpp

index f520ad0ff98518e622bceaec155e2aeab677934e..67db70477986bc3ff98a9c3a38d07bae650c6864 100644 (file)
@@ -285,6 +285,7 @@ int main(int argc, char **argv, char **envp) {
       // gcc accepts -l<lib> and implicitly searches /lib and /usr/lib.
       LibPaths.push_back("/lib");
       LibPaths.push_back("/usr/lib");
+      LibPaths.push_back("/usr/X11R6/lib/");
       // We don't need to link in libc! In fact, /usr/lib/libc.so may not be a
       // shared object at all! See RH 8: plain text.
       std::vector<std::string>::iterator libc = 
@@ -295,7 +296,7 @@ int main(int argc, char **argv, char **envp) {
       for (std::vector<std::string>::iterator i = Libraries.begin(), 
              e = Libraries.end(); i != e; ++i) {
         std::string FullLibraryPath = FindLib(*i, LibPaths, true);
-        if (!FullLibraryPath.empty())
+        if (!FullLibraryPath.empty() && IsSharedObject(FullLibraryPath))
           Out2 << "    -load=" << FullLibraryPath << " \\\n";
       }
       Out2 << "    $0.bc $*\n";