[llvm] [orc-rt] Implement Windows target triple detection (PR #224514)
Jared Wyles via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 06:16:57 PDT 2026
https://github.com/jaredwy updated https://github.com/llvm/llvm-project/pull/224514
>From e5984bc3257c8c558d0b7876bcd536514e76be2b Mon Sep 17 00:00:00 2001
From: Jared Wyles <jared.wyles at gmail.com>
Date: Fri, 18 Sep 2026 14:59:24 +1000
Subject: [PATCH] [orc-rt] Implement Windows target triple detection
---
orc-rt/lib/bedrock/sys/windows/TargetTriple.cpp | 8 +++++++-
orc-rt/test/unit/bedrock/sys/TargetTripleTest.cpp | 7 +++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/orc-rt/lib/bedrock/sys/windows/TargetTriple.cpp b/orc-rt/lib/bedrock/sys/windows/TargetTriple.cpp
index 465a24afc82f8..7a5db97b98f7b 100644
--- a/orc-rt/lib/bedrock/sys/windows/TargetTriple.cpp
+++ b/orc-rt/lib/bedrock/sys/windows/TargetTriple.cpp
@@ -10,6 +10,12 @@
namespace orc_rt::sys {
-std::string detectTargetTriple() noexcept { return {}; }
+std::string detectTargetTriple() noexcept {
+#if defined(_M_X64)
+ return "x86_64-pc-windows-msvc";
+#else
+#error "Unsupported Windows architecture"
+#endif
+}
} // namespace orc_rt::sys
diff --git a/orc-rt/test/unit/bedrock/sys/TargetTripleTest.cpp b/orc-rt/test/unit/bedrock/sys/TargetTripleTest.cpp
index 65675d8db58d6..76e612415ebe1 100644
--- a/orc-rt/test/unit/bedrock/sys/TargetTripleTest.cpp
+++ b/orc-rt/test/unit/bedrock/sys/TargetTripleTest.cpp
@@ -16,7 +16,7 @@
#include <algorithm>
using namespace orc_rt;
-#ifndef _WIN32
+
TEST(TargetTripleTest, NotEmpty) {
EXPECT_FALSE(sys::detectTargetTriple().empty());
}
@@ -46,13 +46,16 @@ TEST(TargetTripleTest, ArchMatchesCompileTarget) {
TEST(TargetTripleTest, OSMatchesCompileTarget) {
auto Triple = sys::detectTargetTriple();
+
#if defined(__APPLE__)
EXPECT_NE(Triple.find("-apple-"), std::string::npos);
#elif defined(__linux__)
EXPECT_NE(Triple.find("-linux-"), std::string::npos);
+#elif defined(_WIN32)
+ EXPECT_NE(Triple.find("-windows-"), std::string::npos);
#endif
}
-#endif
+
TEST(TargetTripleTest, CachedResultIsIdempotent) {
EXPECT_EQ(sys::detectTargetTriple(), sys::detectTargetTriple());
}
More information about the llvm-commits
mailing list