[llvm] [BOLT][RISCV] Add basic RISC-V initialization support for unit tests (PR #222883)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 05:21:58 PDT 2026


================
@@ -56,17 +58,35 @@ struct PerfScriptTestHelper : public testing::TestWithParam<Triple::ArchType> {
     ELF64LE::Ehdr *EHdr = reinterpret_cast<typename ELF64LE::Ehdr *>(ElfBuf);
     EHdr->e_ident[llvm::ELF::EI_CLASS] = llvm::ELF::ELFCLASS64;
     EHdr->e_ident[llvm::ELF::EI_DATA] = llvm::ELF::ELFDATA2LSB;
-    EHdr->e_machine = GetParam() == Triple::aarch64 ? EM_AARCH64 : EM_X86_64;
+    switch (GetParam()) {
+    case Triple::aarch64:
+      EHdr->e_machine = EM_AARCH64;
+      break;
+    case Triple::riscv64:
+      EHdr->e_machine = EM_RISCV;
+      break;
+    case Triple::x86_64:
+      EHdr->e_machine = EM_X86_64;
+      break;
+    default:
+      llvm_unreachable("Unsupported architecture");
+      break;
+    }
----------------
Thrrreeee wrote:

Done.

https://github.com/llvm/llvm-project/pull/222883


More information about the llvm-commits mailing list