Skip to content

[TextAPI] Add riscv32 as a supported arch #152619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions llvm/include/llvm/TextAPI/Architecture.def
Original file line number Diff line number Diff line change
Expand Up @@ -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)
27 changes: 27 additions & 0 deletions llvm/unittests/TextAPI/TextStubV5Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down