From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-6.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by gnuweeb.org (Postfix) with ESMTPS id EDE647E70E for ; Tue, 21 Mar 2023 01:11:41 +0000 (UTC) Authentication-Results: gnuweeb.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=ujOcALg/; dkim-atps=neutral Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9D1AFB811BD; Tue, 21 Mar 2023 01:11:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47C98C4339B; Tue, 21 Mar 2023 01:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679361099; bh=XGdz+sHye8/feWnNVQxyzEvBR9Xb7ks24e30cvZCpAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ujOcALg/qWjsikMv5fDyavRGNNjO00WeYB0/NIyne1+Z1+aN+1ifgOUHPFQ370zKk iHEv/zoXP8b3Y+vRAeBgq1s7ARhjIQtUW6hRpUOdpChNAHS/aQL8zwMg8WjMn33HPC S2rybzeTsb6s0pVSywN7F/ZxBgfdMVDAOlpqSuK0y5+JYNHg/Ni125mp/t18FSR+HF uQJqhZF95slY7ze9lrXBa0xwvavrn53IF8crfxW6ubTW0vnmIPSJ6CNsO0eoQaEkbh gGphvHv7f7n+86Ynql++fEK1sneHQSsRULKPA+R62C3bE2HKOZB2CrxrtQPo8PakiG mw8U4oKovfk0w== Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id DA983154039B; Mon, 20 Mar 2023 18:11:38 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: gwml@vger.gnuweeb.org, kernel-team@meta.com, w@lwt.eu, Vincent Dagonneau , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Willy Tarreau , "Paul E . McKenney" Subject: [PATCH nolibc 03/14] tools/nolibc: add stdint.h Date: Mon, 20 Mar 2023 18:11:26 -0700 Message-Id: <20230321011137.51837-3-paulmck@kernel.org> X-Mailer: git-send-email 2.40.0.rc2 In-Reply-To: <6a3206d0-e5cd-4990-9604-444a24a8207c@paulmck-laptop> References: <6a3206d0-e5cd-4990-9604-444a24a8207c@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: From: Vincent Dagonneau 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 Reviewed-by: Thomas Weißschuh Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney --- 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 + */ + +#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.40.0.rc2