[PATCH 02/18] riscv: update byteorder.h for big-endian
Ben Dooks
ben.dooks at codethink.co.uk
Fri Aug 22 09:52:32 PDT 2025
Add checks for big-endian, using BYTE_ORDER as
modern compilers should define this and anything
that isn't is probably too old to build a system.
Signed-off-by: Ben Dooks <ben.dooks at codethink.co.uk>
---
v2:
- rewritten to add better __BYTE_ORDER check
---
arch/riscv/include/uapi/asm/byteorder.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/riscv/include/uapi/asm/byteorder.h b/arch/riscv/include/uapi/asm/byteorder.h
index f671e16bf6af..88be4af063fb 100644
--- a/arch/riscv/include/uapi/asm/byteorder.h
+++ b/arch/riscv/include/uapi/asm/byteorder.h
@@ -7,6 +7,10 @@
#ifndef _UAPI_ASM_RISCV_BYTEORDER_H
#define _UAPI_ASM_RISCV_BYTEORDER_H
+#if defined(__RISCVEB__) || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
+#include <linux/byteorder/big_endian.h>
+#else
#include <linux/byteorder/little_endian.h>
+#endif
#endif /* _UAPI_ASM_RISCV_BYTEORDER_H */
--
2.37.2.352.g3c44437643
More information about the linux-riscv
mailing list