From: Willy Tarreau <w@1wt.eu>
To: Vincent Dagonneau <v@vda.io>
Cc: linux-kernel@vger.kernel.org
Subject: [RFC PATCH 1/4] tools/nolibc: add stdint.h
Date: Sun, 19 Feb 2023 19:51:30 +0100 [thread overview]
Message-ID: <20230219185133.14576-2-w@1wt.eu> (raw)
In-Reply-To: <20230219185133.14576-1-w@1wt.eu>
From: Vincent Dagonneau <v@vda.io>
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>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
tools/include/nolibc/Makefile | 4 ++--
tools/include/nolibc/std.h | 15 +--------------
tools/include/nolibc/stdint.h | 24 ++++++++++++++++++++++++
3 files changed, 27 insertions(+), 16 deletions(-)
create mode 100644 tools/include/nolibc/stdint.h
diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
index cfd06764b5ae..ec57d3932506 100644
--- a/tools/include/nolibc/Makefile
+++ b/tools/include/nolibc/Makefile
@@ -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
diff --git a/tools/include/nolibc/std.h b/tools/include/nolibc/std.h
index 1747ae125392..933bc0be7e1c 100644
--- a/tools/include/nolibc/std.h
+++ b/tools/include/nolibc/std.h
@@ -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;
diff --git a/tools/include/nolibc/stdint.h b/tools/include/nolibc/stdint.h
new file mode 100644
index 000000000000..4ba264031df9
--- /dev/null
+++ b/tools/include/nolibc/stdint.h
@@ -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 */
--
2.35.3
next prev parent reply other threads:[~2023-02-19 18:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-19 18:51 [RFC PATCH 0/4] tools/nolibc: add stdint and more integer types Willy Tarreau
2023-02-19 18:51 ` Willy Tarreau [this message]
2023-02-19 18:51 ` [RFC PATCH 2/4] tools/nolibc: add integer types and integer limit macros Willy Tarreau
2023-02-19 19:16 ` Thomas Weißschuh
2023-02-19 19:23 ` Willy Tarreau
2023-02-20 9:14 ` David Laight
2023-02-20 14:47 ` Willy Tarreau
2023-02-20 20:27 ` Vincent Dagonneau
2023-02-19 18:51 ` [RFC PATCH 3/4] tools/nolibc: enlarge column width of tests Willy Tarreau
2023-02-19 18:51 ` [RFC PATCH 4/4] tools/nolibc: add tests for the integer limits in stdint.h Willy Tarreau
2023-02-19 19:04 ` Thomas Weißschuh
2023-02-19 19:15 ` Willy Tarreau
2023-02-20 20:29 ` Vincent Dagonneau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230219185133.14576-2-w@1wt.eu \
--to=w@1wt.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=v@vda.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®