[Driver] Gnu.cpp: drop an unneeded special rule related to sysroot
authorFangrui Song <i@maskray.me>
Sun, 21 Mar 2021 04:32:55 +0000 (21:32 -0700)
committerFangrui Song <i@maskray.me>
Sun, 21 Mar 2021 04:32:55 +0000 (21:32 -0700)
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.

clang/lib/Driver/ToolChains/Gnu.cpp

index bd14bbb..39be774 100644 (file)
@@ -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);
   }
 }