[PATCH] D61452: [WebAssembly] Always include <sysroot>/lib in library path

Sam Clegg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 2 10:23:23 PDT 2019


sbc100 created this revision.
Herald added subscribers: cfe-commits, sunfish, aheejin, jgravelle-google, dschuff.
Herald added a project: clang.

Even though the toolchain supports multiarch, we still want to
be able to support single-arch sysroots.

This also helps for the case where libraries don't correctly install to
the multi-arch directory.

This matches the behavior of the linux toolchain and of gcc.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D61452

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
@@ -106,17 +106,17 @@
 
   getProgramPaths().push_back(getDriver().getInstalledDir());
 
-  if (getTriple().getOS() == llvm::Triple::UnknownOS) {
+  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");
-  } else {
     const std::string MultiarchTriple =
         getMultiarchTriple(getDriver(), Triple, getDriver().SysRoot);
     getFilePaths().push_back(getDriver().SysRoot + "/lib/" + MultiarchTriple);
   }
+
+  getFilePaths().push_back(getDriver().SysRoot + "/lib");
 }
 
 bool WebAssembly::IsMathErrnoDefault() const { return false; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61452.197817.patch
Type: text/x-patch
Size: 1119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190502/580457cf/attachment.bin>


More information about the cfe-commits mailing list