summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/u-boot/files/0002-include-fix-ulong-definition-on-musl-targets.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-bsp/u-boot/files/0002-include-fix-ulong-definition-on-musl-targets.patch')
-rw-r--r--meta/recipes-bsp/u-boot/files/0002-include-fix-ulong-definition-on-musl-targets.patch83
1 files changed, 83 insertions, 0 deletions
diff --git a/meta/recipes-bsp/u-boot/files/0002-include-fix-ulong-definition-on-musl-targets.patch b/meta/recipes-bsp/u-boot/files/0002-include-fix-ulong-definition-on-musl-targets.patch
new file mode 100644
index 0000000000..0d965813b0
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/files/0002-include-fix-ulong-definition-on-musl-targets.patch
@@ -0,0 +1,83 @@
1From dccfea2e95cd3f26d1295e02d41012d014827dd9 Mon Sep 17 00:00:00 2001
2From: Sergei Trofimovich <slyfox@gentoo.org>
3Date: Mon, 16 Dec 2019 23:36:40 +0000
4Subject: [PATCH 2/2] include: fix 'ulong' definition on musl targets
5
6The build failure was originally reported on arm64-musl
7target at https://bugs.gentoo.org/703132. Here is the amd64-musl
8variant:
9
10```
11$ LANG=C make CROSS_COMPILE=x86_64-gentoo-linux-musl- tools-only_defconfig -j$(nproc)
12$ LANG=C make CROSS_COMPILE=x86_64-gentoo-linux-musl- tools-all -j$(nproc)
13...
14In file included from tools/env/../../env/flags.c:7,
15 from tools/env/env_flags.c:1:
16include/env.h:159:1: error: unknown type name 'ulong'; did you mean 'long'?
17 159 | ulong env_get_ulong(const char *name, int base, ulong default_val);
18 | ^~~~~
19 | long
20```
21
22Note: 'ulong' is not defined there.
23
24On glibc 'ulong' comes from <sys/types.h>:
25
26```c
27/* Old compatibility names for C types. */
28typedef unsigned long int ulong;
29```
30
31On musl it comes from <sys/types.h> as well but from under different guards:
32
33```c
34typedef unsigned long u_long, ulong;
35```
36
37The change inlines 'ulong' define similar to 'uint' define.
38
39Upstream-Status: Pending
40Bug: https://bugs.gentoo.org/703132
41Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
42Message-Id: <20191216233640.518168-1-slyfox@gentoo.org>
43---
44 include/compiler.h | 2 +-
45 include/u-boot/crc.h | 2 ++
46 2 files changed, 3 insertions(+), 1 deletion(-)
47
48diff --git a/include/compiler.h b/include/compiler.h
49index 29507f9840..90372f239c 100644
50--- a/include/compiler.h
51+++ b/include/compiler.h
52@@ -46,7 +46,6 @@
53 # include <byteswap.h>
54 #elif defined(__MACH__) || defined(__FreeBSD__)
55 # include <machine/endian.h>
56-typedef unsigned long ulong;
57 #endif
58 #ifdef __FreeBSD__
59 # include <sys/endian.h> /* htole32 and friends */
60@@ -66,6 +65,7 @@ typedef uint8_t __u8;
61 typedef uint16_t __u16;
62 typedef uint32_t __u32;
63 typedef unsigned int uint;
64+typedef unsigned long ulong;
65
66 #define uswap_16(x) \
67 ((((x) & 0xff00) >> 8) | \
68diff --git a/include/u-boot/crc.h b/include/u-boot/crc.h
69index 1086d2168c..b96b50d98b 100644
70--- a/include/u-boot/crc.h
71+++ b/include/u-boot/crc.h
72@@ -8,6 +8,8 @@
73 #ifndef _UBOOT_CRC_H
74 #define _UBOOT_CRC_H
75
76+#include <compiler.h> /* unit definition */
77+
78 /**
79 * crc8() - Calculate and return CRC-8 of the data
80 *
81--
822.24.1
83