[llvm] [Offload] define MSVC byte-order macros for rtl endianness checks (PR #202540)

Weronika Lewandowska via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 02:55:48 PDT 2026


https://github.com/wlemkows updated https://github.com/llvm/llvm-project/pull/202540

>From 17e8afd554ac10c723766e695ca6f12bc6e18383 Mon Sep 17 00:00:00 2001
From: Weronika Lewandowska <weronika.lewandowska at intel.com>
Date: Tue, 9 Jun 2026 10:36:30 +0200
Subject: [PATCH] [Offload] define MSVC byte-order macros for rtl endianness
 checks

---
 offload/plugins-nextgen/host/src/rtl.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/offload/plugins-nextgen/host/src/rtl.cpp b/offload/plugins-nextgen/host/src/rtl.cpp
index d977a3e0a9793..e9fb0b5f54f68 100644
--- a/offload/plugins-nextgen/host/src/rtl.cpp
+++ b/offload/plugins-nextgen/host/src/rtl.cpp
@@ -33,6 +33,13 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/raw_ostream.h"
 
+// TODO: Replace with a shared runtime endianness abstraction.
+#if defined(_WIN32)
+#define __ORDER_LITTLE_ENDIAN__ 1234
+#define __ORDER_BIG_ENDIAN__ 4321
+#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
+#endif
+
 #if !defined(__BYTE_ORDER__) || !defined(__ORDER_LITTLE_ENDIAN__) ||           \
     !defined(__ORDER_BIG_ENDIAN__)
 #error "Missing preprocessor definitions for endianness detection."



More information about the llvm-commits mailing list