[llvm] c53eff5 - [llvm-ifs] Add support for --target=riscv

Alex Brachet via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 09:32:08 PST 2023


Author: Alex Brachet
Date: 2023-01-31T17:31:35Z
New Revision: c53eff55e5b0a346b3fe8898411d63edfc786785

URL: https://github.com/llvm/llvm-project/commit/c53eff55e5b0a346b3fe8898411d63edfc786785
DIFF: https://github.com/llvm/llvm-project/commit/c53eff55e5b0a346b3fe8898411d63edfc786785.diff

LOG: [llvm-ifs] Add support for --target=riscv

Added: 
    

Modified: 
    llvm/lib/InterfaceStub/IFSHandler.cpp
    llvm/test/tools/llvm-ifs/write-stub.test

Removed: 
    


################################################################################
diff  --git a/llvm/lib/InterfaceStub/IFSHandler.cpp b/llvm/lib/InterfaceStub/IFSHandler.cpp
index 8bb01836fccb8..e812f36b860d0 100644
--- a/llvm/lib/InterfaceStub/IFSHandler.cpp
+++ b/llvm/lib/InterfaceStub/IFSHandler.cpp
@@ -301,6 +301,9 @@ IFSTarget ifs::parseTriple(StringRef TripleStr) {
   case Triple::ArchType::x86_64:
     RetTarget.Arch = (IFSArch)ELF::EM_X86_64;
     break;
+  case Triple::ArchType::riscv64:
+    RetTarget.Arch = (IFSArch)ELF::EM_RISCV;
+    break;
   default:
     RetTarget.Arch = (IFSArch)ELF::EM_NONE;
   }

diff  --git a/llvm/test/tools/llvm-ifs/write-stub.test b/llvm/test/tools/llvm-ifs/write-stub.test
index d0c0219d64b7d..5444035ca370d 100644
--- a/llvm/test/tools/llvm-ifs/write-stub.test
+++ b/llvm/test/tools/llvm-ifs/write-stub.test
@@ -36,6 +36,8 @@
 # RUN: llvm-readobj -h -S --string-dump .dynstr --string-dump .shstrtab --dyn-symbols --dynamic-table %t.elf | FileCheck %s -DCLASS="64-bit (0x2)" -DDE="LittleEndian (0x1)" -DHS=64 -DPHES=56 -DSHES=64 -DDYNSYMAL=8 -DDYNSYMES=24 -DDYNAMICAL=8 -DDYNAMICES=16 -DDYNTABZ=000000000
 # RUN: llvm-readobj -h -S --string-dump .dynstr --string-dump .shstrtab --dyn-symbols --dynamic-table %t.elf2 | FileCheck %s -DCLASS="64-bit (0x2)" -DDE="LittleEndian (0x1)" -DHS=64 -DPHES=56 -DSHES=64 -DDYNSYMAL=8 -DDYNSYMES=24 -DDYNAMICAL=8 -DDYNAMICES=16 -DDYNTABZ=000000000
 
+# RUN: llvm-ifs --output-elf=- --target=riscv64-linux-gnu %s | llvm-readelf -h - | FileCheck %s --check-prefix=MACHINE
+
 --- !ifs-v1
 IfsVersion: 3.0
 NeededLibs:
@@ -203,3 +205,5 @@ Symbols:
 # TRIPLEERR: error: Target triple cannot be used simultaneously with ELF target format
 # TARGETERR: error: [[MSG]] is not defined in the text stub
 # CONFLICTERR: error: Supplied [[MSG]] conflicts with the text stub
+
+# MACHINE: Machine: RISC-V


        


More information about the llvm-commits mailing list