summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Dooks <[email protected]>2025-06-13 17:12:58 +0100
committerLeo Yu-Chi Liang <[email protected]>2025-07-03 18:10:50 +0800
commit364627596c7142d837912acea0d785ecdfeab676 (patch)
treecd542c8b3565add7ec84d013f255db3cdcb5e891
parent7bd65e89addd62999bd26e8c4b78b1658bba6a5c (diff)
riscv: byteorder: add test for big-endian
Test for big-endian either via __RISCVEB__ which migth be rather old, or check the BYTE_ORDER if the compiler defines it (which should be any modern gcc like v12) Signed-off-by: Ben Dooks <[email protected]> Acked-by: Leo Yu-Chi Liang <[email protected]>
-rw-r--r--arch/riscv/include/asm/byteorder.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/riscv/include/asm/byteorder.h b/arch/riscv/include/asm/byteorder.h
index d26ac5688fa..3140c1f585e 100644
--- a/arch/riscv/include/asm/byteorder.h
+++ b/arch/riscv/include/asm/byteorder.h
@@ -26,7 +26,7 @@
# define __SWAB_64_THRU_32__
#endif
-#ifdef __RISCVEB__
+#if defined(__RISCVEB__) || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#include <linux/byteorder/big_endian.h>
#else
#include <linux/byteorder/little_endian.h>