[PATCH] D134454: [Driver][Distro] Fix ArchLinux sysroot detection
Adrian Ratiu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 28 02:17:29 PDT 2022
10ne1 updated this revision to Diff 463465.
10ne1 marked an inline comment as done.
10ne1 edited the summary of this revision.
Herald added subscribers: atanasyan, arichardson, sdardis.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134454/new/
https://reviews.llvm.org/D134454
Files:
clang/lib/Driver/ToolChains/Linux.cpp
Index: clang/lib/Driver/ToolChains/Linux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Linux.cpp
+++ clang/lib/Driver/ToolChains/Linux.cpp
@@ -355,40 +355,31 @@
return AndroidSysRootPath;
}
- if (getTriple().isCSKY()) {
- // CSKY toolchains use different names for sysroot folder.
- if (!GCCInstallation.isValid())
- return std::string();
- // GCCInstallation.getInstallPath() =
- // $GCCToolchainPath/lib/gcc/csky-linux-gnuabiv2/6.3.0
- // Path = $GCCToolchainPath/csky-linux-gnuabiv2/libc
- std::string Path = (GCCInstallation.getInstallPath() + "/../../../../" +
- GCCInstallation.getTriple().str() + "/libc")
- .str();
- if (getVFS().exists(Path))
- return Path;
- return std::string();
- }
-
- if (!GCCInstallation.isValid() || !getTriple().isMIPS())
+ if (!GCCInstallation.isValid())
return std::string();
- // Standalone MIPS toolchains use different names for sysroot folder
- // and put it into different places. Here we try to check some known
- // variants.
-
const StringRef InstallDir = GCCInstallation.getInstallPath();
const StringRef TripleStr = GCCInstallation.getTriple().str();
- const Multilib &Multilib = GCCInstallation.getMultilib();
+ std::string Path = (InstallDir + "/../../../../" + TripleStr).str();
- std::string Path =
- (InstallDir + "/../../../../" + TripleStr + "/libc" + Multilib.osSuffix())
- .str();
+ // CSKY toolchains use different names for sysroot folder.
+ // GCCInstallation.getInstallPath() =
+ // $GCCToolchainPath/lib/gcc/csky-linux-gnuabiv2/6.3.0
+ // Path = $GCCToolchainPath/csky-linux-gnuabiv2/libc
+ if (getTriple().isCSKY())
+ Path = Path + "/libc";
- if (getVFS().exists(Path))
- return Path;
+ // Standalone MIPS toolchains use different names for sysroot folder
+ // and put it into different places. Here we try to check some known
+ // variants.
+ if (getTriple().isMIPS()) {
+ const Multilib &Multilib = GCCInstallation.getMultilib();
+ Path = Path + "/libc" + Multilib.osSuffix();
+ if (getVFS().exists(Path))
+ return Path;
- Path = (InstallDir + "/../../../../sysroot" + Multilib.osSuffix()).str();
+ Path = (InstallDir + "/../../../../sysroot" + Multilib.osSuffix()).str();
+ }
if (getVFS().exists(Path))
return Path;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134454.463465.patch
Type: text/x-patch
Size: 2425 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220928/eb998425/attachment.bin>
More information about the cfe-commits
mailing list