Debian Codegraph @

debian/patches/0004-Use-GCC-defined-endian-detection.patch

raw
1 Origin: https://github.com/chunkeey/carl9170fw/pull/8
2 From: Bastian Germann <[email protected]>
3 Date: Thu, 30 Jul 2026 22:17:33 +0200
4 Subject: [PATCH 4/7] Use GCC-defined endian detection
5
6 The symbols might not be defined when newlib is not around.
7 Use the GCC symbols instead.
8
9 Signed-off-by: Bastian Germann <[email protected]>
10 ---
11 carlfw/src/memcpy.S | 4 ++--
12 include/linux/types.h | 2 +-
13 tools/lib/carlfw.c | 2 +-
14 3 files changed, 4 insertions(+), 4 deletions(-)
15
16 diff --git a/carlfw/src/memcpy.S b/carlfw/src/memcpy.S
17 index 9539a6b..73971db 100644
18 --- a/carlfw/src/memcpy.S
19 +++ b/carlfw/src/memcpy.S
20 @@ -114,7 +114,7 @@ case1:
21 mov r4,r2
22 add #7,r2
23 !
24 -#ifdef __LITTLE_ENDIAN__
25 +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
26 3: mov r1,r3 ! RQPO
27 shll16 r3
28 shll8 r3 ! Oxxx
29 @@ -196,7 +196,7 @@ case3:
30 mov r4,r2
31 add #7,r2
32 !
33 -#ifdef __LITTLE_ENDIAN__
34 +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
35 3: mov r1,r3 ! RQPO
36 shll8 r3 ! QPOx
37 mov.l @(r0,r5),r1 ! NMLK
38 diff --git a/include/linux/types.h b/include/linux/types.h
39 index 528d207..42762c9 100644
40 --- a/include/linux/types.h
41 +++ b/include/linux/types.h
42 @@ -22,7 +22,7 @@
43 #include <stdlib.h>
44 #include <sys/cdefs.h>
45
46 -#if BYTE_ORDER == BIG_ENDIAN
47 +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
48 #error "big endian is not supported by target"
49 #endif
50
51 diff --git a/tools/lib/carlfw.c b/tools/lib/carlfw.c
52 index 79a7467..9888fe3 100644
53 --- a/tools/lib/carlfw.c
54 +++ b/tools/lib/carlfw.c
55 @@ -349,7 +349,7 @@ static int carlfw_parse_descs(struct carlfw *fw,
56 return err;
57 }
58
59 -#if BYTE_ORDER == LITTLE_ENDIAN
60 +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
61 #define CRCPOLY_LE 0xedb88320
62
63 /* copied from the linux kernel */