[PATCH 1/2] riscv: Define big-endian byte order.
Jovan Dmitrovic
jovan.dmitrovic@htecgroup.com
Wed Nov 4 12:40:49 GMT 2026
From: Djordje Todorovic <djordje.todorovic@htecgroup.com>
Initial big-endian support has landed in the RISC-V psABI spec [1],
so a change in byte order was needed in order to support this
platform.
[1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/470
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Signed-off-by: Đorđe Todorović <djordje.todorovic@htecgroup.com>
ChangeLog:
* sysdeps/riscv/bits/endianness.h (__BYTE_ORDER): Add
big-endian byte order, with little-endian order remaining
as default.
---
sysdeps/riscv/bits/endianness.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sysdeps/riscv/bits/endianness.h b/sysdeps/riscv/bits/endianness.h
index 952d08595a..dd184427cf 100644
--- a/sysdeps/riscv/bits/endianness.h
+++ b/sysdeps/riscv/bits/endianness.h
@@ -5,7 +5,10 @@
# error "Never use <bits/endianness.h> directly; include <endian.h> instead."
#endif
-/* RISC-V is little-endian. */
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
#endif /* bits/endianness.h */
--
2.34.1
More information about the Libc-alpha
mailing list