git: 3c5f0da5106b - main - cross-build: Define __*int*_t and include sys/cdefs.h
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 26 May 2024 17:40:25 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3c5f0da5106bee21ab3726f608b5c377da92a733 commit 3c5f0da5106bee21ab3726f608b5c377da92a733 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2024-05-26 17:39:18 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-05-26 17:39:18 +0000 cross-build: Define __*int*_t and include sys/cdefs.h FreeBSD assumes that sys/types.h includes sys/cdefs.h, so add it here. FreeBSD also needs __*int*_t defined for software we bootstrap (a lot of it). GLIBC defines these, but musl does not, so we have to define them here, even though it looks backwards. There's no good #define to key off of, so use !defined GLIBC since on Linux defacto there's only two libc implementations. Co-authored-by: Val Packett <val@packett.cool> Sponsored by: Netflix Pull Request: https://github.com/freebsd/freebsd-src/pull/1066 Reviewed by: val_packett.cool Differential Revision: https://reviews.freebsd.org/D45354 --- tools/build/cross-build/include/linux/sys/types.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/build/cross-build/include/linux/sys/types.h b/tools/build/cross-build/include/linux/sys/types.h index 222560167a71..2e09cbb62271 100644 --- a/tools/build/cross-build/include/linux/sys/types.h +++ b/tools/build/cross-build/include/linux/sys/types.h @@ -35,6 +35,27 @@ */ #pragma once +#include <sys/cdefs.h> /* FreeBSD source assumes sys/types.h includes this */ +/* + * MUSL doesn't define the __intXX_t that FreeBSD does, but many of our headers + * assume that will always be present. Define them here. We assume !defined + * __GLIBC__ is musl since musl doesn't have a define to key off of. Thesee + * typedefs look backwards, but it's not circular because MUSL never defines the + * __*int*_t. Also, we don't have to work in the kernel, so it's OK to include + * stdint.h here. + */ +#ifndef __GLIBC__ +#include <stdint.h> +typedef int64_t __int64_t; +typedef int32_t __int32_t; +typedef int16_t __int16_t; +typedef int8_t __int8_t; +typedef uint64_t __uint64_t; +typedef uint32_t __uint32_t; +typedef uint16_t __uint16_t; +typedef uint8_t __uint8_t; +#endif + #include_next <sys/types.h> /*