xref: /openbmc/linux/arch/arm/include/uapi/asm/types.h (revision 552b7cb0)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI_ASM_TYPES_H
3 #define _UAPI_ASM_TYPES_H
4 
5 #include <asm-generic/int-ll64.h>
6 
7 /*
8  * The C99 types uintXX_t that are usually defined in 'stdint.h' are not as
9  * unambiguous on ARM as you would expect. For the types below, there is a
10  * difference on ARM between GCC built for bare metal ARM, GCC built for glibc
11  * and the kernel itself, which results in build errors if you try to build with
12  * -ffreestanding and include 'stdint.h' (such as when you include 'arm_neon.h'
13  * in order to use NEON intrinsics)
14  *
15  * As the typedefs for these types in 'stdint.h' are based on builtin defines
16  * supplied by GCC, we can tweak these to align with the kernel's idea of those
17  * types, so 'linux/types.h' and 'stdint.h' can be safely included from the same
18  * source file (provided that -ffreestanding is used).
19  *
20  *                    int32_t         uint32_t               uintptr_t
21  * bare metal GCC     long            unsigned long          unsigned int
22  * glibc GCC          int             unsigned int           unsigned int
23  * kernel             int             unsigned int           unsigned long
24  */
25 
26 #ifdef __INT32_TYPE__
27 #undef __INT32_TYPE__
28 #define __INT32_TYPE__		int
29 #endif
30 
31 #ifdef __UINT32_TYPE__
32 #undef __UINT32_TYPE__
33 #define __UINT32_TYPE__	unsigned int
34 #endif
35 
36 #ifdef __UINTPTR_TYPE__
37 #undef __UINTPTR_TYPE__
38 #define __UINTPTR_TYPE__	unsigned long
39 #endif
40 
41 #endif /* _UAPI_ASM_TYPES_H */
42