[lld] r228440 - [Revert] [ELF] Determine default search directories from Context

Shankar Easwaran shankare at codeaurora.org
Fri Feb 6 13:23:51 PST 2015


Author: shankare
Date: Fri Feb  6 15:23:50 2015
New Revision: 228440

URL: http://llvm.org/viewvc/llvm-project?rev=228440&view=rev
Log:
[Revert] [ELF] Determine default search directories from Context

It looks like the Driver manages search path for each Target lld would support
on the Gnu flavor.

Modified:
    lld/trunk/include/lld/Driver/Driver.h
    lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
    lld/trunk/lib/Driver/GnuLdDriver.cpp
    lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.h

Modified: lld/trunk/include/lld/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/Driver.h?rev=228440&r1=228439&r2=228440&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/Driver.h (original)
+++ lld/trunk/include/lld/Driver/Driver.h Fri Feb  6 15:23:50 2015
@@ -91,6 +91,10 @@ private:
   static bool applyEmulation(llvm::Triple &triple,
                              llvm::opt::InputArgList &args,
                              raw_ostream &diag);
+  static void addPlatformSearchDirs(ELFLinkingContext &ctx,
+                                    llvm::Triple &triple,
+                                    llvm::Triple &baseTriple);
+
   GnuLdDriver() LLVM_DELETED_FUNCTION;
 };
 

Modified: lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h?rev=228440&r1=228439&r2=228440&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h Fri Feb  6 15:23:50 2015
@@ -292,11 +292,6 @@ public:
   bool alignSegments() const { return _alignSegments; }
   void setAlignSegments(bool align) { _alignSegments = align; }
 
-  /// \brief add platform specific search directories.
-  virtual void addDefaultSearchDirs(llvm::Triple & /*triple*/) {
-    addSearchPath("=/usr/lib");
-  }
-
   // We can parse several linker scripts via command line whose ASTs are stored
   // in the current linking context via addLinkerScript().
   void addLinkerScript(std::unique_ptr<script::Parser> script) {

Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=228440&r1=228439&r2=228440&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdDriver.cpp Fri Feb  6 15:23:50 2015
@@ -321,6 +321,18 @@ bool GnuLdDriver::applyEmulation(llvm::T
   return true;
 }
 
+void GnuLdDriver::addPlatformSearchDirs(ELFLinkingContext &ctx,
+                                        llvm::Triple &triple,
+                                        llvm::Triple &baseTriple) {
+  if (triple.getOS() == llvm::Triple::NetBSD &&
+      triple.getArch() == llvm::Triple::x86 &&
+      baseTriple.getArch() == llvm::Triple::x86_64) {
+    ctx.addSearchPath("=/usr/lib/i386");
+    return;
+  }
+  ctx.addSearchPath("=/usr/lib");
+}
+
 std::unique_ptr<ELFLinkingContext>
 GnuLdDriver::createELFLinkingContext(llvm::Triple triple) {
   std::unique_ptr<ELFLinkingContext> p;
@@ -404,7 +416,7 @@ bool GnuLdDriver::parse(int argc, const
 
   // Add the default search directory specific to the target.
   if (!(hasNoStdLib = parsedArgs->hasArg(OPT_nostdlib)))
-    ctx->addDefaultSearchDirs(baseTriple);
+    addPlatformSearchDirs(*ctx, triple, baseTriple);
 
   // Handle --demangle option(For compatibility)
   if (parsedArgs->getLastArg(OPT_demangle))

Modified: lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.h?rev=228440&r1=228439&r2=228440&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.h Fri Feb  6 15:23:50 2015
@@ -36,15 +36,6 @@ public:
       return false;
     }
   }
-
-  void addDefaultSearchDirs(llvm::Triple &baseTriple) override {
-    if (_triple.getOS() == llvm::Triple::NetBSD &&
-        baseTriple.getArch() == llvm::Triple::x86_64) {
-      addSearchPath("=/usr/lib/i386");
-      return;
-    }
-    ELFLinkingContext::addDefaultSearchDirs(baseTriple);
-  }
 };
 } // end namespace elf
 } // end namespace lld





More information about the llvm-commits mailing list