Origin: https://github.com/chunkeey/carl9170fw/pull/8 From: Bastian Germann Date: Thu, 30 Jul 2026 22:17:33 +0200 Subject: [PATCH 4/7] Use GCC-defined endian detection The symbols might not be defined when newlib is not around. Use the GCC symbols instead. Signed-off-by: Bastian Germann --- carlfw/src/memcpy.S | 4 ++-- include/linux/types.h | 2 +- tools/lib/carlfw.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/carlfw/src/memcpy.S b/carlfw/src/memcpy.S index 9539a6b..73971db 100644 --- a/carlfw/src/memcpy.S +++ b/carlfw/src/memcpy.S @@ -114,7 +114,7 @@ case1: mov r4,r2 add #7,r2 ! -#ifdef __LITTLE_ENDIAN__ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 3: mov r1,r3 ! RQPO shll16 r3 shll8 r3 ! Oxxx @@ -196,7 +196,7 @@ case3: mov r4,r2 add #7,r2 ! -#ifdef __LITTLE_ENDIAN__ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 3: mov r1,r3 ! RQPO shll8 r3 ! QPOx mov.l @(r0,r5),r1 ! NMLK diff --git a/include/linux/types.h b/include/linux/types.h index 528d207..42762c9 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -22,7 +22,7 @@ #include #include -#if BYTE_ORDER == BIG_ENDIAN +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ #error "big endian is not supported by target" #endif diff --git a/tools/lib/carlfw.c b/tools/lib/carlfw.c index 79a7467..9888fe3 100644 --- a/tools/lib/carlfw.c +++ b/tools/lib/carlfw.c @@ -349,7 +349,7 @@ static int carlfw_parse_descs(struct carlfw *fw, return err; } -#if BYTE_ORDER == LITTLE_ENDIAN +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #define CRCPOLY_LE 0xedb88320 /* copied from the linux kernel */