tools/nolibc: add stdint.h
Nolibc works fine for small and limited program however most program expect integer types to be defined in stdint.h rather than std.h. This is a quick fix that moves the existing integer definitions in std.h to stdint.h. Signed-off-by: Vincent Dagonneau <v@vda.io> Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
Родитель
d548e9ae07
Коммит
c34da317e0
|
@ -25,8 +25,8 @@ endif
|
|||
|
||||
nolibc_arch := $(patsubst arm64,aarch64,$(ARCH))
|
||||
arch_file := arch-$(nolibc_arch).h
|
||||
all_files := ctype.h errno.h nolibc.h signal.h std.h stdio.h stdlib.h string.h \
|
||||
sys.h time.h types.h unistd.h
|
||||
all_files := ctype.h errno.h nolibc.h signal.h std.h stdint.h stdio.h stdlib.h \
|
||||
string.h sys.h time.h types.h unistd.h
|
||||
|
||||
# install all headers needed to support a bare-metal compiler
|
||||
all: headers
|
||||
|
|
|
@ -18,20 +18,7 @@
|
|||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
/* stdint types */
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef signed long long int64_t;
|
||||
typedef unsigned long size_t;
|
||||
typedef signed long ssize_t;
|
||||
typedef unsigned long uintptr_t;
|
||||
typedef signed long intptr_t;
|
||||
typedef signed long ptrdiff_t;
|
||||
#include "stdint.h"
|
||||
|
||||
/* those are commonly provided by sys/types.h */
|
||||
typedef unsigned int dev_t;
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
|
||||
/*
|
||||
* Standard definitions and types for NOLIBC
|
||||
* Copyright (C) 2023 Vincent Dagonneau <v@vda.io>
|
||||
*/
|
||||
|
||||
#ifndef _NOLIBC_STDINT_H
|
||||
#define _NOLIBC_STDINT_H
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef signed long long int64_t;
|
||||
typedef unsigned long size_t;
|
||||
typedef signed long ssize_t;
|
||||
typedef unsigned long uintptr_t;
|
||||
typedef signed long intptr_t;
|
||||
typedef signed long ptrdiff_t;
|
||||
|
||||
#endif /* _NOLIBC_STDINT_H */
|
Загрузка…
Ссылка в новой задаче