Skip to content

Commit c9f3a70

Browse files
authored
[TextAPI] Add riscv32 as a supported arch (#152619)
1 parent 05dd957 commit c9f3a70

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

llvm/include/llvm/TextAPI/Architecture.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,8 @@ ARCHINFO(arm64e, arm64e, MachO::CPU_TYPE_ARM64, MachO::CPU_SUBTYPE_ARM64E, 64)
4343
/// ARM64_32 architectures sorted by cpu sub type id
4444
///
4545
ARCHINFO(arm64_32, arm64_32, MachO::CPU_TYPE_ARM64_32, MachO::CPU_SUBTYPE_ARM64_32_V8, 32)
46+
47+
///
48+
/// RISCV32 architectures sorted by cpu sub type id
49+
///
50+
ARCHINFO(riscv32, riscv32, MachO::CPU_TYPE_RISCV, MachO::CPU_SUBTYPE_RISCV_ALL, 32)

llvm/unittests/TextAPI/TextStubV5Tests.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,33 @@ TEST(TBDv5, InvalidMinOS) {
11671167
EXPECT_EQ("invalid min_deployment section\n", ErrorMessage);
11681168
}
11691169

1170+
TEST(TBDv5, RISCV) {
1171+
static const char TBDv5File[] = R"({
1172+
"tapi_tbd_version": 5,
1173+
"main_library": {
1174+
"target_info": [
1175+
{
1176+
"target": "riscv32-ios",
1177+
"min_deployment": "34.1"
1178+
}
1179+
],
1180+
"install_names":[
1181+
{ "name":"/S/L/F/Foo.framework/Foo" }
1182+
]
1183+
}})";
1184+
1185+
Expected<TBDFile> Result =
1186+
TextAPIReader::get(MemoryBufferRef(TBDv5File, "Test.tbd"));
1187+
EXPECT_TRUE(!!Result);
1188+
Target ExpectedTarget = Target(AK_riscv32, PLATFORM_IOS, VersionTuple(34, 1));
1189+
TBDFile ReadFile = std::move(Result.get());
1190+
EXPECT_EQ(FileType::TBD_V5, ReadFile->getFileType());
1191+
EXPECT_EQ(std::string("/S/L/F/Foo.framework/Foo"),
1192+
ReadFile->getInstallName());
1193+
EXPECT_TRUE(ReadFile->targets().begin() != ReadFile->targets().end());
1194+
EXPECT_EQ(*ReadFile->targets().begin(), ExpectedTarget);
1195+
}
1196+
11701197
TEST(TBDv5, SimSupport) {
11711198
static const char TBDv5File[] = R"({
11721199
"tapi_tbd_version": 5,

0 commit comments

Comments
 (0)