[llvm] c9f3a70 - [TextAPI] Add riscv32 as a supported arch (#152619)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 19:02:47 PDT 2025


Author: Cyndy Ishida
Date: 2025-08-07T19:02:44-07:00
New Revision: c9f3a706e7a3d265d995424ac8f3f082ffaf980e

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

LOG: [TextAPI] Add riscv32 as a supported arch (#152619)

Added: 
    

Modified: 
    llvm/include/llvm/TextAPI/Architecture.def
    llvm/unittests/TextAPI/TextStubV5Tests.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/TextAPI/Architecture.def b/llvm/include/llvm/TextAPI/Architecture.def
index 5d310c7982444..53877cf0b60ce 100644
--- a/llvm/include/llvm/TextAPI/Architecture.def
+++ b/llvm/include/llvm/TextAPI/Architecture.def
@@ -43,3 +43,8 @@ ARCHINFO(arm64e, arm64e, MachO::CPU_TYPE_ARM64, MachO::CPU_SUBTYPE_ARM64E, 64)
 /// ARM64_32 architectures sorted by cpu sub type id
 ///
 ARCHINFO(arm64_32, arm64_32, MachO::CPU_TYPE_ARM64_32, MachO::CPU_SUBTYPE_ARM64_32_V8, 32)
+
+///
+/// RISCV32 architectures sorted by cpu sub type id
+///
+ARCHINFO(riscv32, riscv32, MachO::CPU_TYPE_RISCV, MachO::CPU_SUBTYPE_RISCV_ALL, 32)

diff  --git a/llvm/unittests/TextAPI/TextStubV5Tests.cpp b/llvm/unittests/TextAPI/TextStubV5Tests.cpp
index 24577b3ec6148..f6689f7524a72 100644
--- a/llvm/unittests/TextAPI/TextStubV5Tests.cpp
+++ b/llvm/unittests/TextAPI/TextStubV5Tests.cpp
@@ -1167,6 +1167,33 @@ TEST(TBDv5, InvalidMinOS) {
   EXPECT_EQ("invalid min_deployment section\n", ErrorMessage);
 }
 
+TEST(TBDv5, RISCV) {
+  static const char TBDv5File[] = R"({ 
+"tapi_tbd_version": 5,
+"main_library": {
+  "target_info": [
+    {
+      "target": "riscv32-ios",
+      "min_deployment": "34.1" 
+    }
+  ],
+  "install_names":[
+    { "name":"/S/L/F/Foo.framework/Foo" }
+  ]
+}})";
+
+  Expected<TBDFile> Result =
+      TextAPIReader::get(MemoryBufferRef(TBDv5File, "Test.tbd"));
+  EXPECT_TRUE(!!Result);
+  Target ExpectedTarget = Target(AK_riscv32, PLATFORM_IOS, VersionTuple(34, 1));
+  TBDFile ReadFile = std::move(Result.get());
+  EXPECT_EQ(FileType::TBD_V5, ReadFile->getFileType());
+  EXPECT_EQ(std::string("/S/L/F/Foo.framework/Foo"),
+            ReadFile->getInstallName());
+  EXPECT_TRUE(ReadFile->targets().begin() != ReadFile->targets().end());
+  EXPECT_EQ(*ReadFile->targets().begin(), ExpectedTarget);
+}
+
 TEST(TBDv5, SimSupport) {
   static const char TBDv5File[] = R"({ 
 "tapi_tbd_version": 5,


        


More information about the llvm-commits mailing list