[PATCH] D65693: [driver][riscv] Support riscv64-linux-gnu multiarch paths

Aurelien Jarno via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 3 01:54:46 PDT 2019


aurel32 created this revision.
aurel32 added reviewers: asb, jrtc27.
aurel32 added projects: clang, LLVM.
Herald added subscribers: cfe-commits, s.egerton, lenary, benna, psnobl, PkmX, rkruppe, rogfer01, shiva0217, kito-cheng, simoncook.

This change adds support for the `riscv64-linux-gnu` multiarch:

- library path in `getMultiarchTriple`
- include path in `AddClangSystemIncludeArgs`

With this change LLVM is able to find libraries and include files on a debian riscv64 system.


Repository:
  rC Clang

https://reviews.llvm.org/D65693

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
@@ -150,6 +150,10 @@
     if (D.getVFS().exists(SysRoot + "/lib/powerpc64le-linux-gnu"))
       return "powerpc64le-linux-gnu";
     break;
+  case llvm::Triple::riscv64:
+    if (D.getVFS().exists(SysRoot + "/lib/riscv64-linux-gnu"))
+      return "riscv64-linux-gnu";
+    break;
   case llvm::Triple::sparc:
     if (D.getVFS().exists(SysRoot + "/lib/sparc-linux-gnu"))
       return "sparc-linux-gnu";
@@ -749,6 +753,8 @@
       "/usr/include/powerpc64-linux-gnu"};
   const StringRef PPC64LEMultiarchIncludeDirs[] = {
       "/usr/include/powerpc64le-linux-gnu"};
+  const StringRef RISCV64MultiarchIncludeDirs[] = {
+      "/usr/include/riscv64-linux-gnu"};
   const StringRef SparcMultiarchIncludeDirs[] = {
       "/usr/include/sparc-linux-gnu"};
   const StringRef Sparc64MultiarchIncludeDirs[] = {
@@ -824,6 +830,9 @@
   case llvm::Triple::ppc64le:
     MultiarchIncludeDirs = PPC64LEMultiarchIncludeDirs;
     break;
+  case llvm::Triple::riscv64:
+    MultiarchIncludeDirs = RISCV64MultiarchIncludeDirs;
+    break;
   case llvm::Triple::sparc:
     MultiarchIncludeDirs = SparcMultiarchIncludeDirs;
     break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65693.213183.patch
Type: text/x-patch
Size: 1321 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190803/cf08b1ca/attachment.bin>


More information about the cfe-commits mailing list