[PATCH v2 0/2] nolibc: remove reliance on system headers

Thomas Weißschuh posted 2 patches 2 years, 3 months ago
tools/include/nolibc/Makefile           |  1 +
tools/include/nolibc/nolibc.h           |  4 ++--
tools/include/nolibc/stdarg.h           | 16 ++++++++++++++++
tools/include/nolibc/stdio.h            |  3 +--
tools/include/nolibc/sys.h              |  2 +-
tools/testing/selftests/nolibc/Makefile |  2 +-
6 files changed, 22 insertions(+), 6 deletions(-)
[PATCH v2 0/2] nolibc: remove reliance on system headers
Posted by Thomas Weißschuh 2 years, 3 months ago
This was prompted by the discussion about output directory support with
O=.
It seems sometimes we were pulling in system headers making testing
annoying and unreliable.

Willy:

I did not implement the '#ifdef va_start` guard that we discussed
before. In my understanding the latest agreement does not need it
anymore. Please let me know if this is incorrect.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Changes in v2:
- Adapt comment in nolibc.h
- <stdarg.h> -> "stdarg.h"
- Link to v1: https://lore.kernel.org/r/20230827-nolibc-nostdinc-v1-0-995d1811f1f3@weissschuh.net

---
Thomas Weißschuh (2):
      tools/nolibc: add stdarg.h header
      selftests/nolibc: use -nostdinc for nolibc-test

 tools/include/nolibc/Makefile           |  1 +
 tools/include/nolibc/nolibc.h           |  4 ++--
 tools/include/nolibc/stdarg.h           | 16 ++++++++++++++++
 tools/include/nolibc/stdio.h            |  3 +--
 tools/include/nolibc/sys.h              |  2 +-
 tools/testing/selftests/nolibc/Makefile |  2 +-
 6 files changed, 22 insertions(+), 6 deletions(-)
---
base-commit: 556fb7131e03b0283672fb40f6dc2d151752aaa7
change-id: 20230827-nolibc-nostdinc-203908130d67

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>

Re: [PATCH v2 0/2] nolibc: remove reliance on system headers
Posted by Willy Tarreau 2 years, 3 months ago
On Wed, Aug 30, 2023 at 05:07:11PM +0200, Thomas Weißschuh wrote:
> This was prompted by the discussion about output directory support with
> O=.
> It seems sometimes we were pulling in system headers making testing
> annoying and unreliable.
> 
> Willy:
> 
> I did not implement the '#ifdef va_start` guard that we discussed
> before. In my understanding the latest agreement does not need it
> anymore. Please let me know if this is incorrect.

No that's fine given your goal of including just "nolibc.h" and no
other regular include file, I agree. I've just merged it and pushed
it to the -next branch.

Thank you Thomas!
Willy
Re: [PATCH v2 0/2] nolibc: remove reliance on system headers
Posted by Zhangjin Wu 2 years, 3 months ago
Hi, Willy

> On Wed, Aug 30, 2023 at 05:07:11PM +0200, Thomas Wei�schuh wrote:
> > This was prompted by the discussion about output directory support with
> > O=.
> > It seems sometimes we were pulling in system headers making testing
> > annoying and unreliable.
> > 
> > Willy:
> > 
> > I did not implement the '#ifdef va_start` guard that we discussed
> > before. In my understanding the latest agreement does not need it
> > anymore. Please let me know if this is incorrect.
> 
> No that's fine given your goal of including just "nolibc.h" and no
> other regular include file, I agree. I've just merged it and pushed
> it to the -next branch.
>
> Thank you Thomas!
> Willy
> 
> Subject: [PATCH v2 1/2] tools/nolibc: add stdarg.h header
> 
> This allows nolic to work with `-nostdinc` avoiding any reliance on
> system headers.
>

A little typo in above commit message: nolic -> nolibc.

Thanks,
Zhangjin

> 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.
Re: [PATCH v2 0/2] nolibc: remove reliance on system headers
Posted by Willy Tarreau 2 years, 3 months ago
On Thu, Aug 31, 2023 at 12:12:02PM +0800, Zhangjin Wu wrote:
> > Subject: [PATCH v2 1/2] tools/nolibc: add stdarg.h header
> > 
> > This allows nolic to work with `-nostdinc` avoiding any reliance on
> > system headers.
> >
> 
> A little typo in above commit message: nolic -> nolibc.

Yeah I noticed and forgot to fix it. Will probably do it next time I
have the opportunity to touch that branch ;-)

Willy