[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 01:48:28 PDT 2026
https://github.com/wlemkows updated https://github.com/llvm/llvm-project/pull/202540
>From 90a71deb6c549347d241cc9dcfbda321ca41e5c4 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..b593c997b386d 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(_MSC_VER) || 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