[PATCH 2/2] riscv: byteorder: add test for big-endian
Tom Rini
trini at konsulko.com
Tue Jun 10 17:33:54 CEST 2025
On Tue, Jun 10, 2025 at 04:18:50PM +0100, Ben Dooks wrote:
> 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 <ben.dooks at codethink.co.uk>
> ---
> arch/riscv/include/asm/byteorder.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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>
What's this look like in the linux kernel? We should likely just mirror
that.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250610/44f2abe1/attachment.sig>
More information about the U-Boot
mailing list