From c45b7920db21c8e0be89b15ea034ff3e9edb8e1d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 25 Sep 2021 07:03:08 -0600 Subject: compiler: Add a comment to host_build() This function should have a comment explaining what it does. Add one. Signed-off-by: Simon Glass --- include/compiler.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/compiler.h') diff --git a/include/compiler.h b/include/compiler.h index 27b9843497a..67e52050b12 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -151,6 +151,11 @@ typedef unsigned long int uintptr_t; #define MEM_SUPPORT_64BIT_DATA 0 #endif +/** + * host_build() - check if we are building for the host + * + * @return true if building for the host, false if for a target + */ static inline bool host_build(void) { #ifdef USE_HOSTCC return true; -- cgit v1.2.3 From 5a4f10d71bfe2b7a5646cf1f96b298805b36df7a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 25 Sep 2021 07:03:13 -0600 Subject: gzip: Avoid use of u64 The gzip API uses the u64 type in it, which is not available in the host build. This makes it impossible to include the header file. We could make this type available, but it seems unnecessary. Limiting the compression size to that of the 'unsigned long' type seems good enough. On 32-bit machines the limit then becomes 4GB, which likely exceeds available RAM anyway, therefore it should be sufficient. On 64-bit machines this is effectively u64 anyway. Update the header file and implementation to use 'ulong' instead of 'u64'. Add a definition of u32 for the cases that seem to need exactly that length. This should be safe enough. Signed-off-by: Simon Glass --- include/compiler.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/compiler.h') diff --git a/include/compiler.h b/include/compiler.h index 67e52050b12..6b0d3bf5374 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -68,6 +68,9 @@ typedef uint32_t __u32; typedef unsigned int uint; typedef unsigned long ulong; +/* Define these on the host so we can build some target code */ +typedef __u32 u32; + #define uswap_16(x) \ ((((x) & 0xff00) >> 8) | \ (((x) & 0x00ff) << 8)) -- cgit v1.2.3 From c9d6b5b5dcce6820ea794af5f046803cdd43b37b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 25 Sep 2021 19:43:14 -0600 Subject: compiler: Rename host_build() to tools_build() With the new TOOLS_LIBCRYPTO and some other changes, it seems that we are heading towards calling this a tools build rather than a host build, although of course it does happen on the host. I cannot think of anything built by the host which cannot be described as a tool, so rename this function. Signed-off-by: Simon Glass Reviewed-by: Alexandru Gagniuc --- include/compiler.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/compiler.h') diff --git a/include/compiler.h b/include/compiler.h index 6b0d3bf5374..8cf11792e24 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -155,11 +155,12 @@ typedef unsigned long int uintptr_t; #endif /** - * host_build() - check if we are building for the host + * tools_build() - check if we are building host tools * * @return true if building for the host, false if for a target */ -static inline bool host_build(void) { +static inline bool tools_build(void) +{ #ifdef USE_HOSTCC return true; #else -- cgit v1.2.3