lkml.org 
[lkml]   [2023]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] tools/nolibc: add stdarg.h header
Hi Thomas,

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.

I'm a bit confused because for me, stdarg was normally provided by the
compiler, but I could be mistaken. It's just that it reminds me not so
old memories. Therefore maybe we just need to include or define
"something" to use it.

> +#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 */

Also, regarding the doubt above, I really think these should be guarded
(maybe just use va_start as a hint), because the risk that they come
from libc headers or maybe from the compiler via another include path
is non-negligible.

Just my two cents,
Willy

\
 
 \ /
  Last update: 2023-08-29 08:30    [W:0.091 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site