[PATCH] D70677: [WebAssembly] Change the llvm-lto dir to use the LLVM Version
sunfishcode via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 25 10:36:36 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rG872a53ef9489: [WebAssembly] Change the llvm-lto dir to use the LLVM Version (authored by sunfishcode).
Changed prior to commit:
https://reviews.llvm.org/D70677?vs=230919&id=230934#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70677/new/
https://reviews.llvm.org/D70677
Files:
clang/lib/Driver/ToolChains/WebAssembly.cpp
Index: clang/lib/Driver/ToolChains/WebAssembly.cpp
===================================================================
--- clang/lib/Driver/ToolChains/WebAssembly.cpp
+++ clang/lib/Driver/ToolChains/WebAssembly.cpp
@@ -118,6 +118,14 @@
}
}
+/// Given a base library directory, append path components to form the
+/// LTO directory.
+static std::string AppendLTOLibDir(const std::string &Dir) {
+ // The version allows the path to be keyed to the specific version of
+ // LLVM in used, as the bitcode format is not stable.
+ return Dir + "/llvm-lto/" LLVM_VERSION_STRING;
+}
+
WebAssembly::WebAssembly(const Driver &D, const llvm::Triple &Triple,
const llvm::opt::ArgList &Args)
: ToolChain(D, Triple, Args) {
@@ -126,26 +134,24 @@
getProgramPaths().push_back(getDriver().getInstalledDir());
+ auto SysRoot = getDriver().SysRoot;
if (getTriple().getOS() == llvm::Triple::UnknownOS) {
// Theoretically an "unknown" OS should mean no standard libraries, however
// it could also mean that a custom set of libraries is in use, so just add
// /lib to the search path. Disable multiarch in this case, to discourage
// paths containing "unknown" from acquiring meanings.
- getFilePaths().push_back(getDriver().SysRoot + "/lib");
+ getFilePaths().push_back(SysRoot + "/lib");
} else {
const std::string MultiarchTriple =
- getMultiarchTriple(getDriver(), Triple, getDriver().SysRoot);
+ getMultiarchTriple(getDriver(), Triple, SysRoot);
if (D.isUsingLTO()) {
- auto LLVMRevision = getLLVMRevision();
- if (!LLVMRevision.empty()) {
- // For LTO, enable use of lto-enabled sysroot libraries too, if available.
- // Note that the directory is keyed to the LLVM revision, as LLVM's
- // bitcode format is not stable.
- getFilePaths().push_back(getDriver().SysRoot + "/lib/" + MultiarchTriple +
- "/llvm-lto/" + LLVMRevision);
- }
+ // For LTO, enable use of lto-enabled sysroot libraries too, if available.
+ // Note that the directory is keyed to the LLVM revision, as LLVM's
+ // bitcode format is not stable.
+ auto Dir = AppendLTOLibDir(SysRoot + "/lib/" + MultiarchTriple);
+ getFilePaths().push_back(Dir);
}
- getFilePaths().push_back(getDriver().SysRoot + "/lib/" + MultiarchTriple);
+ getFilePaths().push_back(SysRoot + "/lib/" + MultiarchTriple);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70677.230934.patch
Type: text/x-patch
Size: 2476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191125/a16785f6/attachment.bin>
More information about the cfe-commits
mailing list