From d11fa9c16b8f50788c07e22bd742177d14e435b2 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Mon, 30 Dec 2019 15:53:41 +0000 Subject: include: fix 'ulong' definition on musl targets The build failure was originally reported on arm64-musl target at https://bugs.gentoo.org/703132. Here is the amd64-musl variant: ``` $ LANG=C make CROSS_COMPILE=x86_64-gentoo-linux-musl- tools-only_defconfig -j$(nproc) $ LANG=C make CROSS_COMPILE=x86_64-gentoo-linux-musl- tools-all -j$(nproc) ... In file included from tools/env/../../env/flags.c:7, from tools/env/env_flags.c:1: include/env.h:159:1: error: unknown type name 'ulong'; did you mean 'long'? 159 | ulong env_get_ulong(const char *name, int base, ulong default_val); | ^~~~~ | long ``` Note: 'ulong' is not defined there. On glibc 'ulong' comes from : ```c /* Old compatibility names for C types. */ typedef unsigned long int ulong; ``` On musl it comes from as well but from under different guards: ```c typedef unsigned long u_long, ulong; ``` The change inlines 'ulong' define similar to 'uint' define. Bug: https://bugs.gentoo.org/703132 Signed-off-by: Sergei Trofimovich --- include/compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/compiler.h b/include/compiler.h index 29507f9840..90372f239c 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -46,7 +46,6 @@ # include #elif defined(__MACH__) || defined(__FreeBSD__) # include -typedef unsigned long ulong; #endif #ifdef __FreeBSD__ # include /* htole32 and friends */ @@ -66,6 +65,7 @@ typedef uint8_t __u8; typedef uint16_t __u16; typedef uint32_t __u32; typedef unsigned int uint; +typedef unsigned long ulong; #define uswap_16(x) \ ((((x) & 0xff00) >> 8) | \ -- cgit From c6ad93612ac90e99ae19103146d1128fef4030ea Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Mon, 30 Dec 2019 15:53:42 +0000 Subject: include/u-boot/crc.h: pull 'uint' definition on musl targets The build failure was originally reported on arm64-musl target at https://bugs.gentoo.org/703132. Here is the amd64-musl variant: ``` $ LANG=C make CROSS_COMPILE=x86_64-gentoo-linux-musl- tools-only_defconfig -j$(nproc) $ LANG=C make CROSS_COMPILE=x86_64-gentoo-linux-musl- tools-all -j$(nproc) ... include/u-boot/crc.h:37:44: error: unknown type name 'uint'; did you mean 'int'? 37 | void crc16_ccitt_wd_buf(const uint8_t *in, uint len, | ^~~~ | int ``` Note: 'uint' is not defined there. On glibc 'uint' comes from and happens to work on most .c files. The change imports 'uint' declaration from ''. Bug: https://bugs.gentoo.org/703132 Signed-off-by: Sergei Trofimovich --- include/u-boot/crc.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/u-boot/crc.h b/include/u-boot/crc.h index 1086d2168c..bfd477f31d 100644 --- a/include/u-boot/crc.h +++ b/include/u-boot/crc.h @@ -8,6 +8,8 @@ #ifndef _UBOOT_CRC_H #define _UBOOT_CRC_H +#include /* 'uint*' definitions */ + /** * crc8() - Calculate and return CRC-8 of the data * -- cgit