Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3984524rdb; Wed, 30 Aug 2023 11:46:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEeKvaWFWicc2Ey09+4p0a+LtrZduflGOsE/6eea8gJMtRvyRbGG4PCH9PphRFj9h21bLvu X-Received: by 2002:a17:902:684c:b0:1c0:9abb:4873 with SMTP id f12-20020a170902684c00b001c09abb4873mr2886337pln.64.1693421173914; Wed, 30 Aug 2023 11:46:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693421173; cv=none; d=google.com; s=arc-20160816; b=L4LsAAtm2W2k1ReeSBUoUYbmO2LbX0LXC0XrUUKadPIvCuGb2BppEymiUV9uh4Qtx2 A8g0uqNspPonDjxbtagLMs8ILgvMDuS3kVRFcyZ6VgYEN8PdZiKnI6OUTVSE96KxfMoi p5g2SiAIHqai9zbxyjjR8lDTU+ZaPV8GiUaYwW+lcE8mdL4mYuMNFXC+8ZoSYtRjXp+w P66xB2rQ0CwhXAT+q9adVD+3TnFBnKcuv9yV/2NzQkDkAHyoMNMkHnxdRlWmrl5t6Uls OnjBSE6GkxKTGVi1cr0stVvPc9TDqSXjcJBecK4PmVnazioFAXtSiWvuz73L061c3V8l 1YtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2PvEZt4TJ1q5BPdEXZ7oawu/xuflZHvphM0sqdEK9Ew=; fh=q1RB602wbnpeA4xEGIahT6LYjwTOYHyG2x6uZL9R6HE=; b=mBOczUv/OKqrZ7qfgkn3OxRm97p6NsTW6rAgUTT4bFTHJa3fdMduEMJLE3twyqpBdo 0HtDoJiSBtwYzOF/69K2kFle/Y0y/E7hDgqp9hbYguGKn8agNjorLu+WyN+yqvpVrCss JK8Rp91Yuj8aoKiyyJUSQS2gnTVcexSV/jAuGgq6feJn+umhq0Nhc/CRz7/BSjXdFRwM BrX8yiy98UpWuUr5R/IEF6pWIRcsM3w+wVm7rCVrHTC9p6CCxeJYUeuUSnOgjosiecm8 37Vz9tX8fVvwe1KVT1v7XS10s3f7IWLeF1bKln57uFcKVcrB/cHQeX5ZBJbzBBXMM47A cnRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a170902cf4900b001b8c6f80ddbsi11576156plg.105.2023.08.30.11.46.00; Wed, 30 Aug 2023 11:46:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236625AbjH3Scg (ORCPT + 99 others); Wed, 30 Aug 2023 14:32:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242212AbjH3H2B (ORCPT ); Wed, 30 Aug 2023 03:28:01 -0400 Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 948751BB; Wed, 30 Aug 2023 00:27:58 -0700 (PDT) Received: (from willy@localhost) by mail.home.local (8.17.1/8.17.1/Submit) id 37U7Rjoa025275; Wed, 30 Aug 2023 09:27:45 +0200 Date: Wed, 30 Aug 2023 09:27:45 +0200 From: Willy Tarreau To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: Shuah Khan , Zhangjin Wu , Yuan Tan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 1/2] tools/nolibc: add stdarg.h header Message-ID: References: <20230827-nolibc-nostdinc-v1-0-995d1811f1f3@weissschuh.net> <20230827-nolibc-nostdinc-v1-1-995d1811f1f3@weissschuh.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230827-nolibc-nostdinc-v1-1-995d1811f1f3@weissschuh.net> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 27, 2023 at 10:00:15AM +0200, Thomas Wei?schuh wrote: > This allows nolic to work with `-nostdinc` avoiding any reliance on > system headers. > > The implementation has been lifted from musl libc 1.2.4. > There is already an implementation of stdarg.h in include/linux/stdarg.h > but that is GPL licensed and therefore not suitable for nolibc. > > The used compiler builtins have been validated to be at least available > since GCC 4.1.2 and clang 3.0.0. > > Signed-off-by: Thomas Wei?schuh > --- > tools/include/nolibc/Makefile | 1 + > tools/include/nolibc/stdarg.h | 16 ++++++++++++++++ > 2 files changed, 17 insertions(+) > > diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile > index 909b6eb500fe..e69c26abe1ea 100644 > --- a/tools/include/nolibc/Makefile > +++ b/tools/include/nolibc/Makefile > @@ -34,6 +34,7 @@ all_files := \ > signal.h \ > stackprotector.h \ > std.h \ > + stdarg.h \ > stdint.h \ > stdlib.h \ > string.h \ > diff --git a/tools/include/nolibc/stdarg.h b/tools/include/nolibc/stdarg.h > new file mode 100644 > index 000000000000..c628b5783da6 > --- /dev/null > +++ b/tools/include/nolibc/stdarg.h > @@ -0,0 +1,16 @@ > +/* SPDX-License-Identifier: LGPL-2.1 OR MIT */ > +/* > + * Variadic argument support for NOLIBC > + * Copyright (C) 2005-2020 Rich Felker, et al. > + */ > + > +#ifndef _NOLIBC_STDARG_H > +#define _NOLIBC_STDARG_H > + > +typedef __builtin_va_list va_list; > +#define va_start(v, l) __builtin_va_start(v, l) > +#define va_end(v) __builtin_va_end(v) > +#define va_arg(v, l) __builtin_va_arg(v, l) > +#define va_copy(d, s) __builtin_va_copy(d, s) > + > +#endif /* _NOLIBC_STDARG_H */ Now with your other explanation I agree, however we need to change: #include to #include "stdarg.h" in stdio.h and sys.h so that we always use ours from now on. Willy