Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Apr 2026 05:03:28 +0000
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 0ccb63941591 - stable/14 - cross-build: Define __*int*_t and include sys/cdefs.h
Message-ID:  <69dc7920.2459c.398042ae@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/14 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=0ccb63941591d8b9ec77b95d3a4dff11c784e2ad

commit 0ccb63941591d8b9ec77b95d3a4dff11c784e2ad
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-05-26 17:39:18 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-04-13 05:02:27 +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
    
    (cherry picked from commit 3c5f0da5106bee21ab3726f608b5c377da92a733)
---
 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 770b3057f8a8..d13e19f9b9b5 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>
 
 #ifndef __size_t


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69dc7920.2459c.398042ae>