Commit c34da317 authored by Vincent Dagonneau's avatar Vincent Dagonneau Committed by Paul E. McKenney
Browse files

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: default avatarVincent Dagonneau <v@vda.io>
Reviewed-by: default avatarThomas Weißschuh <linux@weissschuh.net>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent d548e9ae
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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
+1 −14
Original line number Diff line number Diff line
@@ -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;
+24 −0
Original line number Diff line number Diff line
/* 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 */