[PATCH] D134454: [Driver][Distro] Fix ArchLinux sysroot detection
Adrian Ratiu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 29 06:17:23 PDT 2022
10ne1 updated this revision to Diff 463864.
10ne1 marked an inline comment as done.
10ne1 added a comment.
Updated based on feedback from Nick.
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 += "/libc";
- if (getVFS().exists(Path))
- return Path;
+ // Standalone MIPS toolchains use different names for sysroot folder
+ // and put it into different places. Here check the two known variants.
+ else if (getTriple().isMIPS()) {
+ const std::string &OSSuffix = GCCInstallation.getMultilib().osSuffix();
- Path = (InstallDir + "/../../../../sysroot" + Multilib.osSuffix()).str();
+ Path += "/libc" + OSSuffix;
+ if (getVFS().exists(Path))
+ return Path;
+
+ Path = (InstallDir + "/../../../../sysroot" + OSSuffix).str();
+ }
if (getVFS().exists(Path))
return Path;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134454.463864.patch
Type: text/x-patch
Size: 2399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220929/ece2c288/attachment.bin>
More information about the cfe-commits
mailing list