]> granicus.if.org Git - clang/commitdiff
Memorize presence/absence of -nostdlib in Driver.
authorJoerg Sonnenberger <joerg@bec.de>
Mon, 21 Mar 2011 13:59:26 +0000 (13:59 +0000)
committerJoerg Sonnenberger <joerg@bec.de>
Mon, 21 Mar 2011 13:59:26 +0000 (13:59 +0000)
Drop program paths on NetBSD (unused). Only include lib dir, if
-nostdlib is absent. Use = to allow --sysroot to work.

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

include/clang/Driver/Driver.h
lib/Driver/Driver.cpp
lib/Driver/ToolChains.cpp

index 5047793b64681b48840f9891f2c05961817fe58b..7f6db0f992e6a786e88f99ecfd871b4daed49dba 100644 (file)
@@ -80,6 +80,9 @@ public:
   /// sysroot, if present
   std::string SysRoot;
 
+  /// If the standard library is used
+  bool UseStdLib;
+
   /// Default host triple.
   std::string DefaultHostTriple;
 
index fac8c8c88ff0fe02bddeceaba692e71162fac4bf..ef647d8c067dcf7bdd37229c40e3de1a15f9bb16 100644 (file)
@@ -58,8 +58,8 @@ Driver::Driver(llvm::StringRef _ClangExecutable,
                bool IsProduction, bool CXXIsProduction,
                Diagnostic &_Diags)
   : Opts(createDriverOptTable()), Diags(_Diags),
-    ClangExecutable(_ClangExecutable), DefaultHostTriple(_DefaultHostTriple),
-    DefaultImageName(_DefaultImageName),
+    ClangExecutable(_ClangExecutable), UseStdLib(true),
+    DefaultHostTriple(_DefaultHostTriple), DefaultImageName(_DefaultImageName),
     DriverTitle("clang \"gcc-compatible\" driver"),
     Host(0),
     CCPrintOptionsFilename(0), CCPrintHeadersFilename(0), CCCIsCXX(false),
@@ -289,6 +289,8 @@ Compilation *Driver::BuildCompilation(int argc, const char **argv) {
   }
   if (const Arg *A = Args->getLastArg(options::OPT__sysroot_EQ))
     SysRoot = A->getValue(*Args);
+  if (Args->hasArg(options::OPT_nostdlib))
+    UseStdLib = false;
 
   Host = GetHostInfo(DefaultHostTriple.c_str());
 
index 523ff14b0a58877dd304eda8f7621b1fdd0613cf..d4691ac86ef48154d1eeae334c57d9e15c2aef28 100644 (file)
@@ -1018,12 +1018,11 @@ NetBSD::NetBSD(const HostInfo &Host, const llvm::Triple& Triple)
         llvm::Triple::x86_64)
     Lib32 = true;
 
-  getProgramPaths().push_back(getDriver().Dir + "/../libexec");
-  getProgramPaths().push_back("/usr/libexec");
-  if (Lib32) {
-    getFilePaths().push_back("/usr/lib/i386");
-  } else {
-    getFilePaths().push_back("/usr/lib");
+  if (getDriver().UseStdLib) {
+    if (Lib32)
+      getFilePaths().push_back("=/usr/lib/i386");
+    else
+      getFilePaths().push_back("=/usr/lib");
   }
 }