[clang] 56700e9 - [Driver] Gnu.cpp: drop an unneeded special rule related to sysroot

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 20 21:33:01 PDT 2021


Author: Fangrui Song
Date: 2021-03-20T21:32:55-07:00
New Revision: 56700e937903969a4a95f68c59e38e35daaaa1ea

URL: https://github.com/llvm/llvm-project/commit/56700e937903969a4a95f68c59e38e35daaaa1ea
DIFF: https://github.com/llvm/llvm-project/commit/56700e937903969a4a95f68c59e38e35daaaa1ea.diff

LOG: [Driver] Gnu.cpp: drop an unneeded special rule related to sysroot

Seem unnecessary to diverge from GCC here.
Beside, lib/../$OSLibDir can be considered closer to the GCC
installation then the system root. The comment should not apply.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Gnu.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index bd14bbb63f3a..39be77463544 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2834,17 +2834,7 @@ void Generic_GCC::AddMultilibPaths(const Driver &D,
                         SelectedMultilib.osSuffix(),
                     Paths);
 
-    // If the GCC installation we found is inside of the sysroot, we want to
-    // prefer libraries installed in the parent prefix of the GCC installation.
-    // It is important to *not* use these paths when the GCC installation is
-    // outside of the system root as that can pick up unintended libraries.
-    // This usually happens when there is an external cross compiler on the
-    // host system, and a more minimal sysroot available that is the target of
-    // the cross. Note that GCC does include some of these directories in some
-    // configurations but this seems somewhere between questionable and simply
-    // a bug.
-    if (StringRef(LibPath).startswith(SysRoot))
-      addPathIfExists(D, LibPath + "/../" + OSLibDir, Paths);
+    addPathIfExists(D, LibPath + "/../" + OSLibDir, Paths);
   }
 }
 


        


More information about the cfe-commits mailing list