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:
Vincent Dagonneau 2023-03-04 15:26:03 +01:00 коммит произвёл Paul E. McKenney
Родитель d548e9ae07
Коммит c34da317e0
3 изменённых файлов: 27 добавлений и 16 удалений

Просмотреть файл

@ -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 */