git: ad448b507431 - stable/12 - Reapply r326600 (by imp):

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Wed, 22 Dec 2021 10:05:31 UTC
The branch stable/12 has been updated by dim:

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

commit ad448b507431a6bc98c94416e8f5d8151e3750fd
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2020-08-02 18:30:29 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-12-22 09:58:14 +0000

    Reapply r326600 (by imp):
    
    Since this is contrib code, create an upstreamable version of my
    change. Now on FreeBSD and NetBSD if _STANDALONE is defined, we
    include the kernel version with alloances for the quirky differences
    between the two.
    
    Sponsored by: Netflix
    
    (cherry picked from commit dd6565b7a60d228f021190a538caeb652275dc5c)
---
 contrib/llvm-project/compiler-rt/lib/builtins/int_lib.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/int_lib.h b/contrib/llvm-project/compiler-rt/lib/builtins/int_lib.h
index 713deddb5698..4a972da23fcc 100644
--- a/contrib/llvm-project/compiler-rt/lib/builtins/int_lib.h
+++ b/contrib/llvm-project/compiler-rt/lib/builtins/int_lib.h
@@ -72,12 +72,16 @@
 #error Unsupported target
 #endif
 
-#if defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE))
+#if (defined(__FreeBSD__) || defined(__NetBSD__)) && (defined(_KERNEL) || defined(_STANDALONE))
 //
 // Kernel and boot environment can't use normal headers,
 // so use the equivalent system headers.
 //
+#ifdef __FreeBSD__
+#include <sys/limits.h>
+#else
 #include <machine/limits.h>
+#endif
 #include <sys/stdint.h>
 #include <sys/types.h>
 #else